#pragma GCC target("avx512f")
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
vector<long long> 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<long long, long long>> 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 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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
0 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 |
0 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 |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
260 KB |
Output is correct |
19 |
Correct |
7 ms |
468 KB |
Output is correct |
20 |
Correct |
7 ms |
544 KB |
Output is correct |
21 |
Correct |
7 ms |
468 KB |
Output is correct |
22 |
Correct |
51 ms |
512 KB |
Output is correct |
23 |
Correct |
50 ms |
496 KB |
Output is correct |
24 |
Correct |
53 ms |
588 KB |
Output is correct |
25 |
Correct |
52 ms |
492 KB |
Output is correct |
26 |
Correct |
52 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
321 ms |
15296 KB |
Output is correct |
2 |
Correct |
332 ms |
15216 KB |
Output is correct |
3 |
Correct |
317 ms |
15016 KB |
Output is correct |
4 |
Correct |
329 ms |
15220 KB |
Output is correct |
5 |
Execution timed out |
3007 ms |
15000 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
3039 ms |
4576 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3067 ms |
13100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
0 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 |
0 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 |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
260 KB |
Output is correct |
19 |
Correct |
7 ms |
468 KB |
Output is correct |
20 |
Correct |
7 ms |
544 KB |
Output is correct |
21 |
Correct |
7 ms |
468 KB |
Output is correct |
22 |
Correct |
51 ms |
512 KB |
Output is correct |
23 |
Correct |
50 ms |
496 KB |
Output is correct |
24 |
Correct |
53 ms |
588 KB |
Output is correct |
25 |
Correct |
52 ms |
492 KB |
Output is correct |
26 |
Correct |
52 ms |
492 KB |
Output is correct |
27 |
Correct |
14 ms |
724 KB |
Output is correct |
28 |
Correct |
18 ms |
784 KB |
Output is correct |
29 |
Correct |
13 ms |
664 KB |
Output is correct |
30 |
Correct |
230 ms |
724 KB |
Output is correct |
31 |
Correct |
221 ms |
660 KB |
Output is correct |
32 |
Correct |
220 ms |
732 KB |
Output is correct |
33 |
Correct |
128 ms |
5204 KB |
Output is correct |
34 |
Correct |
127 ms |
5088 KB |
Output is correct |
35 |
Correct |
129 ms |
5204 KB |
Output is correct |
36 |
Execution timed out |
3053 ms |
4576 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
0 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 |
0 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 |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
260 KB |
Output is correct |
19 |
Correct |
7 ms |
468 KB |
Output is correct |
20 |
Correct |
7 ms |
544 KB |
Output is correct |
21 |
Correct |
7 ms |
468 KB |
Output is correct |
22 |
Correct |
51 ms |
512 KB |
Output is correct |
23 |
Correct |
50 ms |
496 KB |
Output is correct |
24 |
Correct |
53 ms |
588 KB |
Output is correct |
25 |
Correct |
52 ms |
492 KB |
Output is correct |
26 |
Correct |
52 ms |
492 KB |
Output is correct |
27 |
Correct |
321 ms |
15296 KB |
Output is correct |
28 |
Correct |
332 ms |
15216 KB |
Output is correct |
29 |
Correct |
317 ms |
15016 KB |
Output is correct |
30 |
Correct |
329 ms |
15220 KB |
Output is correct |
31 |
Execution timed out |
3007 ms |
15000 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |