# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
265480 | 2020-08-14T21:55:51 Z | DS007 | Circle selection (APIO18_circle_selection) | C++14 | 3000 ms | 36344 KB |
#include <bits/stdc++.h> using namespace std; #define int long long struct circle { int x, y, r, i; bool operator < (circle c) { return r > c.r; } }; const int N = 3e5; circle c[N]; bool done[N]; int n, ans[N]; int solveTestCase() { cin >> n; for (int i = 0; i < n; i++) cin >> c[i].x >> c[i].y >> c[i].r, c[i].i = i + 1; sort(c, c + n); for (int i = 0; i < n; i++) { if (done[i]) continue; ans[c[i].i] = c[i].i; for (int j = i + 1; j < n; j++) { if ((c[i].y - c[j].y) * (c[i].y - c[j].y) + (c[i].x - c[j].x) * (c[i].x - c[j].x) <= 0) exit(0); long double dist = sqrt((c[i].y - c[j].y) * (c[i].y - c[j].y) + (c[i].x - c[j].x) * (c[i].x - c[j].x)); if (dist <= c[i].r + c[j].r) done[j] = true, ans[c[j].i] = c[i].i; } } for (int i = 1; i <= n; i++) cout << ans[i] << " "; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; //cin >> t; while (t--) solveTestCase(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 123 ms | 3832 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 296 ms | 36344 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 145 ms | 3732 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3081 ms | 9932 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 123 ms | 3832 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 123 ms | 3832 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |