Comments (1)
#include <bits/stdc++.h>
using namespace std;
class FloodFill {
public:
vector getCell(vector , vector , long long);
};
const int inf = (int) 5e8;
vector FloodFill::getCell(vector X, vector Y, long long A) {
int n = (int) X.size();
auto Count = [&](int rad, int max_x, int max_y) -> long long {
vector xa(n);
vector ya(n);
vector xb(n);
vector yb(n);
for (int i = 0; i < n; i++) {
xa[i] = X[i] - rad;
ya[i] = Y[i] - rad;
xb[i] = X[i] + rad + 1;
yb[i] = Y[i] + rad + 1;
}
vector xs;
vector ys;
for (int i = 0; i < n; i++) {
xs.push_back(xa[i]);
ys.push_back(ya[i]);
xs.push_back(xb[i]);
ys.push_back(yb[i]);
}
xs.push_back(max_x);
xs.push_back(max_x - 1);
ys.push_back(max_y);
sort(xs.begin(), xs.end());
xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
sort(ys.begin(), ys.end());
ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
long long ret = 0;
for (int i = 0; i < (int) xs.size() - 1; i++) {
for (int j = 0; j < (int) ys.size() - 1; j++) {
int x1 = xs[i];
int y1 = ys[j];
int x2 = xs[i + 1];
int y2 = ys[j + 1];
if (x2 > max_x || (x2 == max_x && y2 > max_y)) {
continue;
}
bool inside = false;
for (int k = 0; k < n; k++) {
if (x1 >= xa[k] && y1 >= ya[k] && xb[k] >= x2 && yb[k] >= y2) {
inside = true;
break;
}
from geekweek-local.
Related Issues (20)
- geek week local
- frogs
- gwl task HOT 1
- GWL CONTENT ISSUE HOT 1
- Issue in step-3 of README.md HOT 1
- geekweek-local HOT 1
- No full stop in line 42. HOT 2
- geek week local issue HOT 1
- geek week local issue HOT 1
- geekweek local issue HOT 1
- GWL HOT 1
- GWL LOCAL ISSUE HOT 1
- Geekweek-Local HOT 1
- need image to home page
- Issue 1 HOT 1
- Issue from readme file HOT 1
- issue 1 HOT 1
- gwl HOT 1
- Issue in readme file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geekweek-local.