#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N;
cin>>N;
vector<int> X(N),Y(N),R(N);
for(int i=0;i<N;i++) cin>>X[i]>>Y[i]>>R[i];
vector<int> A(N,N+1);
vector<pair<int,int>> S(N);
for(int i=0;i<N;i++) S[i] = {R[i],N-1-i};
sort(S.rbegin(),S.rend());
for(int i=0;i<N;i++){
int r = S[i].first, ind = N-1-S[i].second;
if(A[ind] != N+1) continue;
for(int j=0;j<N;j++){
if(A[j] == N+1 && (X[ind]-X[j])*(X[ind]-X[j])+(Y[ind]-Y[j])*(Y[ind]-Y[j]) <= (R[ind]+R[j])*(R[ind]+R[j])){
A[j] = ind+1;
}
}
}
for(int i=0;i<N;i++) cout<<A[i]<<' ';
cout<<endl;
}
Compilation message
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:14:9: warning: unused variable 'r' [-Wunused-variable]
14 | int r = S[i].first, ind = N-1-S[i].second;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
304 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
312 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
308 KB |
Output is correct |
19 |
Correct |
7 ms |
596 KB |
Output is correct |
20 |
Correct |
8 ms |
652 KB |
Output is correct |
21 |
Correct |
7 ms |
596 KB |
Output is correct |
22 |
Correct |
63 ms |
652 KB |
Output is correct |
23 |
Correct |
65 ms |
652 KB |
Output is correct |
24 |
Correct |
62 ms |
596 KB |
Output is correct |
25 |
Correct |
60 ms |
652 KB |
Output is correct |
26 |
Correct |
57 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
380 ms |
16428 KB |
Output is correct |
2 |
Correct |
373 ms |
18380 KB |
Output is correct |
3 |
Correct |
364 ms |
18156 KB |
Output is correct |
4 |
Correct |
332 ms |
18376 KB |
Output is correct |
5 |
Execution timed out |
3088 ms |
16256 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
3061 ms |
4960 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3042 ms |
14380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
304 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
312 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
308 KB |
Output is correct |
19 |
Correct |
7 ms |
596 KB |
Output is correct |
20 |
Correct |
8 ms |
652 KB |
Output is correct |
21 |
Correct |
7 ms |
596 KB |
Output is correct |
22 |
Correct |
63 ms |
652 KB |
Output is correct |
23 |
Correct |
65 ms |
652 KB |
Output is correct |
24 |
Correct |
62 ms |
596 KB |
Output is correct |
25 |
Correct |
60 ms |
652 KB |
Output is correct |
26 |
Correct |
57 ms |
640 KB |
Output is correct |
27 |
Correct |
14 ms |
1108 KB |
Output is correct |
28 |
Correct |
14 ms |
1088 KB |
Output is correct |
29 |
Correct |
13 ms |
1076 KB |
Output is correct |
30 |
Correct |
245 ms |
1028 KB |
Output is correct |
31 |
Correct |
252 ms |
1020 KB |
Output is correct |
32 |
Correct |
239 ms |
1048 KB |
Output is correct |
33 |
Correct |
135 ms |
7436 KB |
Output is correct |
34 |
Correct |
157 ms |
7456 KB |
Output is correct |
35 |
Correct |
135 ms |
7432 KB |
Output is correct |
36 |
Execution timed out |
3051 ms |
6864 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
304 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
312 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
308 KB |
Output is correct |
19 |
Correct |
7 ms |
596 KB |
Output is correct |
20 |
Correct |
8 ms |
652 KB |
Output is correct |
21 |
Correct |
7 ms |
596 KB |
Output is correct |
22 |
Correct |
63 ms |
652 KB |
Output is correct |
23 |
Correct |
65 ms |
652 KB |
Output is correct |
24 |
Correct |
62 ms |
596 KB |
Output is correct |
25 |
Correct |
60 ms |
652 KB |
Output is correct |
26 |
Correct |
57 ms |
640 KB |
Output is correct |
27 |
Correct |
380 ms |
16428 KB |
Output is correct |
28 |
Correct |
373 ms |
18380 KB |
Output is correct |
29 |
Correct |
364 ms |
18156 KB |
Output is correct |
30 |
Correct |
332 ms |
18376 KB |
Output is correct |
31 |
Execution timed out |
3088 ms |
16256 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |