We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
#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; }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: