# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
476574 | 2021-09-27T16:49:50 Z | hongrae03k | 원 고르기 (APIO18_circle_selection) | C++17 | 3000 ms | 19992 KB |
#include <bits/stdc++.h> using namespace std; typedef long long i64; const int MAX = 3e5 + 9; struct Circle { i64 x, y; i64 rad, idx; } circles[MAX]; bool cmpRad(Circle& a, Circle& b) { if (a.rad == b.rad) return a.idx < b.idx; return a.rad > b.rad; } bool intercept(Circle& a, Circle &b) { i64 dx = a.x * 1LL - b.x * 1LL; i64 dy = a.y * 1LL - b.y * 1LL; i64 dist2 = dx * dx * 1LL + dy * dy * 1LL; i64 rad2 = (a.rad + b.rad) * (a.rad + b.rad) * 1LL; return dist2 <= rad2; } int par[MAX]; bool deleted[MAX]; int main() { int N; scanf("%d", &N); for (int i = 0; i < N; ++i) { scanf("%lld%lld%lld", &circles[i].x, &circles[i].y, &circles[i].rad); circles[i].idx = i; } sort(circles, circles + N, cmpRad); for (int i = 0; i < N; ++i) { deleted[i] = false; } for (int i = 0; i < N; ++i) { int u = circles[i].idx; if (deleted[u]) continue; par[u] = u; for (int j = i + 1; j < N; ++j) { int v = circles[j].idx; if (deleted[v]) continue; if (intercept(circles[i], circles[j])) { par[v] = u; deleted[v] = true; } } deleted[u] = true; } for (int i = 0; i < N; ++i) { printf("%d ", par[i] + 1); } printf("\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 | 204 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 | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 296 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 296 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 304 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 | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 4 ms | 568 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 25 ms | 624 KB | Output is correct |
23 | Correct | 25 ms | 588 KB | Output is correct |
24 | Correct | 25 ms | 628 KB | Output is correct |
25 | Correct | 26 ms | 616 KB | Output is correct |
26 | Correct | 36 ms | 588 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 184 ms | 19952 KB | Output is correct |
2 | Correct | 192 ms | 19992 KB | Output is correct |
3 | Correct | 176 ms | 19656 KB | Output is correct |
4 | Correct | 177 ms | 19912 KB | Output is correct |
5 | Execution timed out | 3081 ms | 15752 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 300 KB | Output is correct |
2 | Execution timed out | 3070 ms | 6720 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3077 ms | 17980 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 | 204 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 | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 296 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 296 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 304 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 | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 4 ms | 568 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 25 ms | 624 KB | Output is correct |
23 | Correct | 25 ms | 588 KB | Output is correct |
24 | Correct | 25 ms | 628 KB | Output is correct |
25 | Correct | 26 ms | 616 KB | Output is correct |
26 | Correct | 36 ms | 588 KB | Output is correct |
27 | Correct | 7 ms | 972 KB | Output is correct |
28 | Correct | 6 ms | 908 KB | Output is correct |
29 | Correct | 6 ms | 1008 KB | Output is correct |
30 | Correct | 95 ms | 924 KB | Output is correct |
31 | Correct | 93 ms | 928 KB | Output is correct |
32 | Correct | 92 ms | 936 KB | Output is correct |
33 | Correct | 59 ms | 7620 KB | Output is correct |
34 | Correct | 61 ms | 7572 KB | Output is correct |
35 | Correct | 58 ms | 7452 KB | Output is correct |
36 | Execution timed out | 3067 ms | 6380 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 | 204 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 | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 296 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 296 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 304 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 | 332 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 4 ms | 568 KB | Output is correct |
20 | Correct | 3 ms | 588 KB | Output is correct |
21 | Correct | 4 ms | 588 KB | Output is correct |
22 | Correct | 25 ms | 624 KB | Output is correct |
23 | Correct | 25 ms | 588 KB | Output is correct |
24 | Correct | 25 ms | 628 KB | Output is correct |
25 | Correct | 26 ms | 616 KB | Output is correct |
26 | Correct | 36 ms | 588 KB | Output is correct |
27 | Correct | 184 ms | 19952 KB | Output is correct |
28 | Correct | 192 ms | 19992 KB | Output is correct |
29 | Correct | 176 ms | 19656 KB | Output is correct |
30 | Correct | 177 ms | 19912 KB | Output is correct |
31 | Execution timed out | 3081 ms | 15752 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |