# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658747 | 2022-11-14T20:02:36 Z | 600Mihnea | Circle selection (APIO18_circle_selection) | C++17 | 0 ms | 212 KB |
bool home = 1; #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = (int) 3e5 + 7; int n; struct Circle { int x; int y; int r; }; bool doIntersect(Circle a, Circle b) { /// dist <= a.r + b.r /// dist ^ 2 <= (a.r + b.r) ^ 2 return 1LL * (a.x - b.x) * (a.x - b.x) + 1LL * (a.y - b.y) * (a.y - b.y) <= 1LL * (a.r + b.r) * (a.r + b.r); } Circle circles[N]; int ret[N]; int main() { if (home == 0) { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } else { freopen ("input.txt", "r", stdin); } cin >> n; for (int i = 1; i <= n; i++) { cin >> circles[i].x >> circles[i].y >> circles[i].r; } vector<int> inds(n); iota(inds.begin(), inds.end(), 1); while ((int) inds.size() >= 1) { int best = inds[0]; for (auto &ind : inds) { if (circles[ind].r > circles[best].r || (circles[ind].r == circles[best].r && ind < best)) { best = ind; } } vector<int> newInds; for (auto &ind : inds) { if (doIntersect(circles[ind], circles[best])) { ret[ind] = best; } else { newInds.push_back(ind); } } inds = newInds; } for (int i = 1; i <= n; i++) { cout << ret[i] << " "; } cout << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |