# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49426 | 2018-05-28T16:55:46 Z | gs13105 | Circle selection (APIO18_circle_selection) | C++17 | 157 ms | 5340 KB |
#include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <iterator> using namespace std; struct cir { int x, y, r, i; bool operator <(const cir &a) const { return r != a.r ? r > a.r : i < a.i; } }; cir arr[300010]; int num[300010]; int res[300010]; bool inter(const cir &a, const cir &b) { 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); } int main() { //freopen("in", "r", stdin); //freopen("out", "w", stdout); int n, i, j; scanf("%d", &n); for(i = 1; i <= n; i++) { int x, y, r; scanf("%d%d%d", &x, &y, &r); arr[i] = { x, y, r, i }; } sort(arr + 1, arr + n + 1); if(n <= 5000) { for(i = 1; i <= n; i++) if(!num[i]) for(j = 1; j <= n; j++) if(!num[j] && inter(arr[i], arr[j])) num[j] = arr[i].i; for(i = 1; i <= n; i++) res[arr[i].i] = num[i]; for(i = 1; i <= n; i++) printf("%d ", res[i]); return 0; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 480 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 2 ms | 484 KB | Output is correct |
8 | Correct | 3 ms | 560 KB | Output is correct |
9 | Correct | 3 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 592 KB | Output is correct |
12 | Correct | 2 ms | 592 KB | Output is correct |
13 | Correct | 2 ms | 612 KB | Output is correct |
14 | Correct | 3 ms | 612 KB | Output is correct |
15 | Correct | 3 ms | 612 KB | Output is correct |
16 | Correct | 3 ms | 728 KB | Output is correct |
17 | Correct | 3 ms | 728 KB | Output is correct |
18 | Correct | 3 ms | 728 KB | Output is correct |
19 | Correct | 6 ms | 748 KB | Output is correct |
20 | Correct | 7 ms | 748 KB | Output is correct |
21 | Correct | 6 ms | 764 KB | Output is correct |
22 | Correct | 62 ms | 780 KB | Output is correct |
23 | Correct | 49 ms | 796 KB | Output is correct |
24 | Correct | 50 ms | 796 KB | Output is correct |
25 | Correct | 49 ms | 800 KB | Output is correct |
26 | Correct | 47 ms | 800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 153 ms | 5340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5340 KB | Output is correct |
2 | Incorrect | 68 ms | 5340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 157 ms | 5340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 480 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 2 ms | 484 KB | Output is correct |
8 | Correct | 3 ms | 560 KB | Output is correct |
9 | Correct | 3 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 592 KB | Output is correct |
12 | Correct | 2 ms | 592 KB | Output is correct |
13 | Correct | 2 ms | 612 KB | Output is correct |
14 | Correct | 3 ms | 612 KB | Output is correct |
15 | Correct | 3 ms | 612 KB | Output is correct |
16 | Correct | 3 ms | 728 KB | Output is correct |
17 | Correct | 3 ms | 728 KB | Output is correct |
18 | Correct | 3 ms | 728 KB | Output is correct |
19 | Correct | 6 ms | 748 KB | Output is correct |
20 | Correct | 7 ms | 748 KB | Output is correct |
21 | Correct | 6 ms | 764 KB | Output is correct |
22 | Correct | 62 ms | 780 KB | Output is correct |
23 | Correct | 49 ms | 796 KB | Output is correct |
24 | Correct | 50 ms | 796 KB | Output is correct |
25 | Correct | 49 ms | 800 KB | Output is correct |
26 | Correct | 47 ms | 800 KB | Output is correct |
27 | Incorrect | 9 ms | 5340 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 480 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 2 ms | 484 KB | Output is correct |
8 | Correct | 3 ms | 560 KB | Output is correct |
9 | Correct | 3 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 592 KB | Output is correct |
12 | Correct | 2 ms | 592 KB | Output is correct |
13 | Correct | 2 ms | 612 KB | Output is correct |
14 | Correct | 3 ms | 612 KB | Output is correct |
15 | Correct | 3 ms | 612 KB | Output is correct |
16 | Correct | 3 ms | 728 KB | Output is correct |
17 | Correct | 3 ms | 728 KB | Output is correct |
18 | Correct | 3 ms | 728 KB | Output is correct |
19 | Correct | 6 ms | 748 KB | Output is correct |
20 | Correct | 7 ms | 748 KB | Output is correct |
21 | Correct | 6 ms | 764 KB | Output is correct |
22 | Correct | 62 ms | 780 KB | Output is correct |
23 | Correct | 49 ms | 796 KB | Output is correct |
24 | Correct | 50 ms | 796 KB | Output is correct |
25 | Correct | 49 ms | 800 KB | Output is correct |
26 | Correct | 47 ms | 800 KB | Output is correct |
27 | Incorrect | 153 ms | 5340 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |