# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
106502 | 2019-04-19T01:32:43 Z | bert30702 | Circle selection (APIO18_circle_selection) | C++17 | 3000 ms | 20152 KB |
#include <bits/stdc++.h> #define pii pair<int, int> #define F first #define S second #define X real() #define Y imag() using namespace std; typedef complex<long double> C; const int MX = 3e5 + 100; struct circle { C p; int r, i; } v[MX]; int ans[MX]; main () { srand(time(0)); int n; cin >> n; for(int i = 1; i <= n; i ++) { int x, y, r; cin >> x >> y >> r; v[i] = {{x, y}, r, i}; } double ang = rand() * 0.0001; for(int i = 1; i <= n; i ++) v[i].p *= C{cos(ang), sin(ang)}; sort(v + 1, v + 1 + n, [](circle a, circle b) { return a.p.X < b.p.X; }); priority_queue<pii> pq; for(int i = 1; i <= n; i ++) pq.push({v[i].r, -i}); while(pq.size()) { pii p = pq.top(); pq.pop(); p.S = -p.S; if(ans[v[p.S].i]) continue; for(int i = max(1, p.S - 200); i <= min(n, p.S + 200); i ++) { if(!ans[v[i].i] and abs(v[p.S].p - v[i].p) <= v[p.S].r + v[i].r) ans[v[i].i] = v[p.S].i; } } for(int i = 1; i <= n; i ++) cout << ans[i] << ' '; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 14464 KB | Output is correct |
2 | Correct | 16 ms | 14464 KB | Output is correct |
3 | Correct | 13 ms | 14464 KB | Output is correct |
4 | Correct | 13 ms | 14464 KB | Output is correct |
5 | Correct | 13 ms | 14464 KB | Output is correct |
6 | Correct | 13 ms | 14464 KB | Output is correct |
7 | Correct | 13 ms | 14464 KB | Output is correct |
8 | Correct | 13 ms | 14464 KB | Output is correct |
9 | Correct | 13 ms | 14464 KB | Output is correct |
10 | Correct | 13 ms | 14464 KB | Output is correct |
11 | Correct | 14 ms | 14464 KB | Output is correct |
12 | Correct | 15 ms | 14464 KB | Output is correct |
13 | Correct | 15 ms | 14464 KB | Output is correct |
14 | Correct | 14 ms | 14464 KB | Output is correct |
15 | Correct | 14 ms | 14464 KB | Output is correct |
16 | Incorrect | 15 ms | 14464 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 514 ms | 20152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 14464 KB | Output is correct |
2 | Correct | 1273 ms | 16272 KB | Output is correct |
3 | Execution timed out | 3022 ms | 18664 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3035 ms | 18664 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 14464 KB | Output is correct |
2 | Correct | 16 ms | 14464 KB | Output is correct |
3 | Correct | 13 ms | 14464 KB | Output is correct |
4 | Correct | 13 ms | 14464 KB | Output is correct |
5 | Correct | 13 ms | 14464 KB | Output is correct |
6 | Correct | 13 ms | 14464 KB | Output is correct |
7 | Correct | 13 ms | 14464 KB | Output is correct |
8 | Correct | 13 ms | 14464 KB | Output is correct |
9 | Correct | 13 ms | 14464 KB | Output is correct |
10 | Correct | 13 ms | 14464 KB | Output is correct |
11 | Correct | 14 ms | 14464 KB | Output is correct |
12 | Correct | 15 ms | 14464 KB | Output is correct |
13 | Correct | 15 ms | 14464 KB | Output is correct |
14 | Correct | 14 ms | 14464 KB | Output is correct |
15 | Correct | 14 ms | 14464 KB | Output is correct |
16 | Incorrect | 15 ms | 14464 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 14464 KB | Output is correct |
2 | Correct | 16 ms | 14464 KB | Output is correct |
3 | Correct | 13 ms | 14464 KB | Output is correct |
4 | Correct | 13 ms | 14464 KB | Output is correct |
5 | Correct | 13 ms | 14464 KB | Output is correct |
6 | Correct | 13 ms | 14464 KB | Output is correct |
7 | Correct | 13 ms | 14464 KB | Output is correct |
8 | Correct | 13 ms | 14464 KB | Output is correct |
9 | Correct | 13 ms | 14464 KB | Output is correct |
10 | Correct | 13 ms | 14464 KB | Output is correct |
11 | Correct | 14 ms | 14464 KB | Output is correct |
12 | Correct | 15 ms | 14464 KB | Output is correct |
13 | Correct | 15 ms | 14464 KB | Output is correct |
14 | Correct | 14 ms | 14464 KB | Output is correct |
15 | Correct | 14 ms | 14464 KB | Output is correct |
16 | Incorrect | 15 ms | 14464 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |