# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49098 | 2018-05-22T05:15:45 Z | BThero | Circle selection (APIO18_circle_selection) | C++17 | 3000 ms | 8768 KB |
// Why am I so stupid? :c #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second typedef long long ll; using namespace std; const int MAXN = 3e5+5; struct circle { int x, y, r, id; circle() { x = y = r = id = 0; } } arr[MAXN]; int ans[MAXN]; int n; bool cmp(circle a, circle b) { if (a.r == b.r) { return a.id < b.id; } return a.r > b.r; } bool inter(circle a, circle b) { ll d = (a.x - b.x) * 1ll * (a.x - b.x) + (a.y - b.y) * 1ll * (a.y - b.y); return d <= (a.r + b.r) * 1ll * (a.r + b.r); } void solve() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d %d %d", &arr[i].x, &arr[i].y, &arr[i].r); arr[i].id = i; } sort(arr + 1, arr + n + 1, cmp); vector <circle> vv; for (int i = 1; i <= n; ++i) { ans[arr[i].id] = arr[i].id; for (circle it : vv) { if (inter(arr[i], it)) { ans[arr[i].id] = it.id; break; } } if (ans[arr[i].id] == arr[i].id) { vv.pb(arr[i]); } } for (int i = 1; i <= n; ++i) { printf("%d ", ans[i]); } } int main() { #ifdef BThero freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // BThero int tt = 1; while (tt--) { solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4984 KB | Output is correct |
2 | Correct | 5 ms | 5092 KB | Output is correct |
3 | Correct | 6 ms | 5168 KB | Output is correct |
4 | Correct | 5 ms | 5168 KB | Output is correct |
5 | Correct | 5 ms | 5252 KB | Output is correct |
6 | Correct | 5 ms | 5252 KB | Output is correct |
7 | Correct | 6 ms | 5252 KB | Output is correct |
8 | Correct | 6 ms | 5252 KB | Output is correct |
9 | Correct | 6 ms | 5252 KB | Output is correct |
10 | Correct | 7 ms | 5252 KB | Output is correct |
11 | Correct | 6 ms | 5356 KB | Output is correct |
12 | Correct | 7 ms | 5356 KB | Output is correct |
13 | Correct | 6 ms | 5356 KB | Output is correct |
14 | Correct | 6 ms | 5356 KB | Output is correct |
15 | Correct | 6 ms | 5356 KB | Output is correct |
16 | Correct | 7 ms | 5356 KB | Output is correct |
17 | Correct | 9 ms | 5356 KB | Output is correct |
18 | Correct | 21 ms | 5356 KB | Output is correct |
19 | Correct | 9 ms | 5372 KB | Output is correct |
20 | Correct | 12 ms | 5372 KB | Output is correct |
21 | Correct | 10 ms | 5504 KB | Output is correct |
22 | Correct | 38 ms | 5648 KB | Output is correct |
23 | Correct | 39 ms | 5664 KB | Output is correct |
24 | Correct | 39 ms | 5680 KB | Output is correct |
25 | Correct | 38 ms | 5680 KB | Output is correct |
26 | Correct | 53 ms | 5680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 196 ms | 8512 KB | Output is correct |
2 | Correct | 199 ms | 8580 KB | Output is correct |
3 | Correct | 216 ms | 8580 KB | Output is correct |
4 | Correct | 205 ms | 8580 KB | Output is correct |
5 | Correct | 1068 ms | 8768 KB | Output is correct |
6 | Execution timed out | 3048 ms | 8768 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 8768 KB | Output is correct |
2 | Execution timed out | 3021 ms | 8768 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3039 ms | 8768 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4984 KB | Output is correct |
2 | Correct | 5 ms | 5092 KB | Output is correct |
3 | Correct | 6 ms | 5168 KB | Output is correct |
4 | Correct | 5 ms | 5168 KB | Output is correct |
5 | Correct | 5 ms | 5252 KB | Output is correct |
6 | Correct | 5 ms | 5252 KB | Output is correct |
7 | Correct | 6 ms | 5252 KB | Output is correct |
8 | Correct | 6 ms | 5252 KB | Output is correct |
9 | Correct | 6 ms | 5252 KB | Output is correct |
10 | Correct | 7 ms | 5252 KB | Output is correct |
11 | Correct | 6 ms | 5356 KB | Output is correct |
12 | Correct | 7 ms | 5356 KB | Output is correct |
13 | Correct | 6 ms | 5356 KB | Output is correct |
14 | Correct | 6 ms | 5356 KB | Output is correct |
15 | Correct | 6 ms | 5356 KB | Output is correct |
16 | Correct | 7 ms | 5356 KB | Output is correct |
17 | Correct | 9 ms | 5356 KB | Output is correct |
18 | Correct | 21 ms | 5356 KB | Output is correct |
19 | Correct | 9 ms | 5372 KB | Output is correct |
20 | Correct | 12 ms | 5372 KB | Output is correct |
21 | Correct | 10 ms | 5504 KB | Output is correct |
22 | Correct | 38 ms | 5648 KB | Output is correct |
23 | Correct | 39 ms | 5664 KB | Output is correct |
24 | Correct | 39 ms | 5680 KB | Output is correct |
25 | Correct | 38 ms | 5680 KB | Output is correct |
26 | Correct | 53 ms | 5680 KB | Output is correct |
27 | Correct | 14 ms | 8768 KB | Output is correct |
28 | Correct | 14 ms | 8768 KB | Output is correct |
29 | Correct | 12 ms | 8768 KB | Output is correct |
30 | Correct | 126 ms | 8768 KB | Output is correct |
31 | Correct | 112 ms | 8768 KB | Output is correct |
32 | Correct | 116 ms | 8768 KB | Output is correct |
33 | Correct | 86 ms | 8768 KB | Output is correct |
34 | Correct | 90 ms | 8768 KB | Output is correct |
35 | Correct | 83 ms | 8768 KB | Output is correct |
36 | Execution timed out | 3024 ms | 8768 KB | Time limit exceeded |
37 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4984 KB | Output is correct |
2 | Correct | 5 ms | 5092 KB | Output is correct |
3 | Correct | 6 ms | 5168 KB | Output is correct |
4 | Correct | 5 ms | 5168 KB | Output is correct |
5 | Correct | 5 ms | 5252 KB | Output is correct |
6 | Correct | 5 ms | 5252 KB | Output is correct |
7 | Correct | 6 ms | 5252 KB | Output is correct |
8 | Correct | 6 ms | 5252 KB | Output is correct |
9 | Correct | 6 ms | 5252 KB | Output is correct |
10 | Correct | 7 ms | 5252 KB | Output is correct |
11 | Correct | 6 ms | 5356 KB | Output is correct |
12 | Correct | 7 ms | 5356 KB | Output is correct |
13 | Correct | 6 ms | 5356 KB | Output is correct |
14 | Correct | 6 ms | 5356 KB | Output is correct |
15 | Correct | 6 ms | 5356 KB | Output is correct |
16 | Correct | 7 ms | 5356 KB | Output is correct |
17 | Correct | 9 ms | 5356 KB | Output is correct |
18 | Correct | 21 ms | 5356 KB | Output is correct |
19 | Correct | 9 ms | 5372 KB | Output is correct |
20 | Correct | 12 ms | 5372 KB | Output is correct |
21 | Correct | 10 ms | 5504 KB | Output is correct |
22 | Correct | 38 ms | 5648 KB | Output is correct |
23 | Correct | 39 ms | 5664 KB | Output is correct |
24 | Correct | 39 ms | 5680 KB | Output is correct |
25 | Correct | 38 ms | 5680 KB | Output is correct |
26 | Correct | 53 ms | 5680 KB | Output is correct |
27 | Correct | 196 ms | 8512 KB | Output is correct |
28 | Correct | 199 ms | 8580 KB | Output is correct |
29 | Correct | 216 ms | 8580 KB | Output is correct |
30 | Correct | 205 ms | 8580 KB | Output is correct |
31 | Correct | 1068 ms | 8768 KB | Output is correct |
32 | Execution timed out | 3048 ms | 8768 KB | Time limit exceeded |
33 | Halted | 0 ms | 0 KB | - |