# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
477100 | 2021-09-30T12:42:17 Z | khr03ae | 원 고르기 (APIO18_circle_selection) | C++14 | 3000 ms | 18876 KB |
#include <bits/stdc++.h> using namespace std; typedef long long i64; const int MAX = 3e5 + 9; struct Circle { i64 x, y, rad; } C[MAX]; int sorted[MAX], par[MAX]; bool deleted[MAX]; bool cmp(int i, int j) { if (C[i].rad == C[j].rad) return i < j; return C[i].rad > C[j].rad; } bool intercept(int i, int j) { i64 dx = 1LL * C[i].x - 1LL * C[j].x; i64 dy = 1LL * C[i].y - 1LL * C[j].y; i64 dist2 = 1LL * dx * dx + 1LL * dy * dy; i64 rad2 = 1LL * (C[i].rad + C[j].rad) * (C[i].rad + C[j].rad); return dist2 <= rad2; } int main() { int N; scanf("%d", &N); for (int i = 0; i < N; ++i) { scanf("%lld%lld%lld", &C[i].x, &C[i].y, &C[i].rad); } // Initialize for (int i = 0; i < N; ++i) { sorted[i] = i; deleted[i] = false; } sort(sorted, sorted + N, cmp); for (int i = 0; i < N; ++i) { int u = sorted[i]; if (deleted[u]) continue; for (int j = i + 1; j < N; ++j) { int v = sorted[j]; if (deleted[v]) continue; if (intercept(u, v)) { par[v] = u; deleted[v] = true; } } par[u] = u; deleted[u] = true; } for (int i = 0; i < N; ++i) { printf("%d ", par[i] + 1); } puts("\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 312 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 3 ms | 716 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 60 ms | 588 KB | Output is correct |
23 | Correct | 53 ms | 600 KB | Output is correct |
24 | Correct | 53 ms | 588 KB | Output is correct |
25 | Correct | 52 ms | 588 KB | Output is correct |
26 | Correct | 59 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 217 ms | 18876 KB | Output is correct |
2 | Correct | 217 ms | 18708 KB | Output is correct |
3 | Correct | 214 ms | 18384 KB | Output is correct |
4 | Correct | 209 ms | 18848 KB | Output is correct |
5 | Execution timed out | 3076 ms | 14476 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 3076 ms | 6524 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3089 ms | 16804 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 312 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 3 ms | 716 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 60 ms | 588 KB | Output is correct |
23 | Correct | 53 ms | 600 KB | Output is correct |
24 | Correct | 53 ms | 588 KB | Output is correct |
25 | Correct | 52 ms | 588 KB | Output is correct |
26 | Correct | 59 ms | 596 KB | Output is correct |
27 | Correct | 6 ms | 972 KB | Output is correct |
28 | Correct | 7 ms | 972 KB | Output is correct |
29 | Correct | 6 ms | 972 KB | Output is correct |
30 | Correct | 244 ms | 884 KB | Output is correct |
31 | Correct | 206 ms | 844 KB | Output is correct |
32 | Correct | 219 ms | 904 KB | Output is correct |
33 | Correct | 67 ms | 7188 KB | Output is correct |
34 | Correct | 66 ms | 7148 KB | Output is correct |
35 | Correct | 67 ms | 7012 KB | Output is correct |
36 | Execution timed out | 3077 ms | 6096 KB | Time limit exceeded |
37 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 312 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 3 ms | 716 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 60 ms | 588 KB | Output is correct |
23 | Correct | 53 ms | 600 KB | Output is correct |
24 | Correct | 53 ms | 588 KB | Output is correct |
25 | Correct | 52 ms | 588 KB | Output is correct |
26 | Correct | 59 ms | 596 KB | Output is correct |
27 | Correct | 217 ms | 18876 KB | Output is correct |
28 | Correct | 217 ms | 18708 KB | Output is correct |
29 | Correct | 214 ms | 18384 KB | Output is correct |
30 | Correct | 209 ms | 18848 KB | Output is correct |
31 | Execution timed out | 3076 ms | 14476 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |