#include<iostream>
#include<stdio.h>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long int lld;
lld sq(lld a){
return a*a;
}
int main(){
int n;
cin>>n;
lld circles[n][3];
bool valid[n];
int cnt=n;
for(int i=0;i<n;i++){valid[i]=true;
cin>>circles[i][0]>>circles[i][1]>>circles[i][2];
}
int arr[n];
while(cnt>0){
int maior=-1;
for(int i=0;i<n;i++){
if(valid[i] && (maior==-1 || circles[maior][2]<circles[i][2]))maior=i;
}
for(int i=0;i<n;i++){
if(valid[i] && sq(circles[i][2]+circles[maior][2])>=sq(circles[i][1]-circles[maior][1])+sq(circles[i][0]-circles[maior][0])){
arr[i]=maior;
valid[i]=false;
cnt--;
}
}
/*for(int i=0;i<n;i++)cout<<sq(circles[i][1]-circles[maior][1])+sq(circles[i][0]-circles[maior][0])<<" ";
cout<<endl;
for(int i=0;i<n;i++)cout<<sq(circles[i][2]+circles[maior][2])<<" ";
cout<<endl;*/
}
for(int i=0;i<n;i++){
cout<<arr[i]+1<<" ";
}cout<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
520 KB |
Output is correct |
5 |
Correct |
3 ms |
576 KB |
Output is correct |
6 |
Correct |
3 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
2 ms |
624 KB |
Output is correct |
9 |
Correct |
4 ms |
624 KB |
Output is correct |
10 |
Correct |
3 ms |
624 KB |
Output is correct |
11 |
Correct |
3 ms |
624 KB |
Output is correct |
12 |
Correct |
3 ms |
704 KB |
Output is correct |
13 |
Correct |
3 ms |
704 KB |
Output is correct |
14 |
Correct |
4 ms |
704 KB |
Output is correct |
15 |
Correct |
4 ms |
704 KB |
Output is correct |
16 |
Correct |
5 ms |
760 KB |
Output is correct |
17 |
Correct |
5 ms |
780 KB |
Output is correct |
18 |
Correct |
4 ms |
832 KB |
Output is correct |
19 |
Correct |
11 ms |
1196 KB |
Output is correct |
20 |
Correct |
13 ms |
1296 KB |
Output is correct |
21 |
Correct |
11 ms |
1488 KB |
Output is correct |
22 |
Correct |
207 ms |
1640 KB |
Output is correct |
23 |
Correct |
191 ms |
1872 KB |
Output is correct |
24 |
Correct |
204 ms |
1916 KB |
Output is correct |
25 |
Correct |
191 ms |
2044 KB |
Output is correct |
26 |
Correct |
216 ms |
2180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
418 ms |
19336 KB |
Output is correct |
2 |
Correct |
483 ms |
26088 KB |
Output is correct |
3 |
Correct |
410 ms |
32440 KB |
Output is correct |
4 |
Correct |
507 ms |
39420 KB |
Output is correct |
5 |
Execution timed out |
3051 ms |
42012 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
42012 KB |
Output is correct |
2 |
Execution timed out |
3061 ms |
42012 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3035 ms |
51600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
520 KB |
Output is correct |
5 |
Correct |
3 ms |
576 KB |
Output is correct |
6 |
Correct |
3 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
2 ms |
624 KB |
Output is correct |
9 |
Correct |
4 ms |
624 KB |
Output is correct |
10 |
Correct |
3 ms |
624 KB |
Output is correct |
11 |
Correct |
3 ms |
624 KB |
Output is correct |
12 |
Correct |
3 ms |
704 KB |
Output is correct |
13 |
Correct |
3 ms |
704 KB |
Output is correct |
14 |
Correct |
4 ms |
704 KB |
Output is correct |
15 |
Correct |
4 ms |
704 KB |
Output is correct |
16 |
Correct |
5 ms |
760 KB |
Output is correct |
17 |
Correct |
5 ms |
780 KB |
Output is correct |
18 |
Correct |
4 ms |
832 KB |
Output is correct |
19 |
Correct |
11 ms |
1196 KB |
Output is correct |
20 |
Correct |
13 ms |
1296 KB |
Output is correct |
21 |
Correct |
11 ms |
1488 KB |
Output is correct |
22 |
Correct |
207 ms |
1640 KB |
Output is correct |
23 |
Correct |
191 ms |
1872 KB |
Output is correct |
24 |
Correct |
204 ms |
1916 KB |
Output is correct |
25 |
Correct |
191 ms |
2044 KB |
Output is correct |
26 |
Correct |
216 ms |
2180 KB |
Output is correct |
27 |
Correct |
24 ms |
51600 KB |
Output is correct |
28 |
Correct |
19 ms |
51600 KB |
Output is correct |
29 |
Correct |
24 ms |
51600 KB |
Output is correct |
30 |
Correct |
930 ms |
51600 KB |
Output is correct |
31 |
Correct |
884 ms |
51600 KB |
Output is correct |
32 |
Correct |
863 ms |
51600 KB |
Output is correct |
33 |
Correct |
168 ms |
52504 KB |
Output is correct |
34 |
Correct |
210 ms |
55464 KB |
Output is correct |
35 |
Correct |
219 ms |
58516 KB |
Output is correct |
36 |
Execution timed out |
3053 ms |
60508 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
520 KB |
Output is correct |
5 |
Correct |
3 ms |
576 KB |
Output is correct |
6 |
Correct |
3 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
2 ms |
624 KB |
Output is correct |
9 |
Correct |
4 ms |
624 KB |
Output is correct |
10 |
Correct |
3 ms |
624 KB |
Output is correct |
11 |
Correct |
3 ms |
624 KB |
Output is correct |
12 |
Correct |
3 ms |
704 KB |
Output is correct |
13 |
Correct |
3 ms |
704 KB |
Output is correct |
14 |
Correct |
4 ms |
704 KB |
Output is correct |
15 |
Correct |
4 ms |
704 KB |
Output is correct |
16 |
Correct |
5 ms |
760 KB |
Output is correct |
17 |
Correct |
5 ms |
780 KB |
Output is correct |
18 |
Correct |
4 ms |
832 KB |
Output is correct |
19 |
Correct |
11 ms |
1196 KB |
Output is correct |
20 |
Correct |
13 ms |
1296 KB |
Output is correct |
21 |
Correct |
11 ms |
1488 KB |
Output is correct |
22 |
Correct |
207 ms |
1640 KB |
Output is correct |
23 |
Correct |
191 ms |
1872 KB |
Output is correct |
24 |
Correct |
204 ms |
1916 KB |
Output is correct |
25 |
Correct |
191 ms |
2044 KB |
Output is correct |
26 |
Correct |
216 ms |
2180 KB |
Output is correct |
27 |
Correct |
418 ms |
19336 KB |
Output is correct |
28 |
Correct |
483 ms |
26088 KB |
Output is correct |
29 |
Correct |
410 ms |
32440 KB |
Output is correct |
30 |
Correct |
507 ms |
39420 KB |
Output is correct |
31 |
Execution timed out |
3051 ms |
42012 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |