n = int(input())
from math import sqrt
def intersect(x1,y1,r1,x2,y2,r2):
dist = sqrt(pow(x1-x2,2) + pow(y1-y2,2))
if dist <= r1 + r2:
return True
return False
circles = []
for i in range(n):
temp = tuple(map(int,input().split()))
circles.append((i+1,temp[0],temp[1],temp[2]))
ais = [-1] * n
circles.sort(key=lambda x: x[3],reverse=True)
for i in range(n):
if ais[circles[i][0]-1] != -1:
continue
x, y, r = circles[i][1],circles[i][2],circles[i][3]
ais[circles[i][0]-1] = circles[i][0]
# this is largest circle, find intersecting circles
for j in range(i+1,n):
if ais[circles[j][0]-1] != -1:
continue
if intersect(x,y,r,circles[j][1],circles[j][2],circles[j][3]):
ais[circles[j][0]-1] = circles[i][0]
#print(ais)
print(' '.join(map(str,ais)))
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
12 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2908 KB |
Output is correct |
4 |
Correct |
13 ms |
2904 KB |
Output is correct |
5 |
Correct |
12 ms |
2908 KB |
Output is correct |
6 |
Correct |
11 ms |
2900 KB |
Output is correct |
7 |
Correct |
12 ms |
2908 KB |
Output is correct |
8 |
Correct |
11 ms |
3108 KB |
Output is correct |
9 |
Correct |
11 ms |
2908 KB |
Output is correct |
10 |
Correct |
13 ms |
3112 KB |
Output is correct |
11 |
Correct |
18 ms |
2908 KB |
Output is correct |
12 |
Correct |
19 ms |
2864 KB |
Output is correct |
13 |
Correct |
17 ms |
3116 KB |
Output is correct |
14 |
Correct |
17 ms |
3116 KB |
Output is correct |
15 |
Correct |
18 ms |
2904 KB |
Output is correct |
16 |
Correct |
16 ms |
3420 KB |
Output is correct |
17 |
Correct |
16 ms |
3372 KB |
Output is correct |
18 |
Correct |
15 ms |
3280 KB |
Output is correct |
19 |
Correct |
32 ms |
4512 KB |
Output is correct |
20 |
Correct |
34 ms |
4696 KB |
Output is correct |
21 |
Correct |
35 ms |
4656 KB |
Output is correct |
22 |
Execution timed out |
3096 ms |
4244 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1637 ms |
85648 KB |
Output is correct |
2 |
Correct |
1981 ms |
85504 KB |
Output is correct |
3 |
Correct |
1776 ms |
85232 KB |
Output is correct |
4 |
Correct |
1601 ms |
85532 KB |
Output is correct |
5 |
Execution timed out |
3030 ms |
55848 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
2908 KB |
Output is correct |
2 |
Execution timed out |
3083 ms |
27376 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3049 ms |
72452 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
12 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2908 KB |
Output is correct |
4 |
Correct |
13 ms |
2904 KB |
Output is correct |
5 |
Correct |
12 ms |
2908 KB |
Output is correct |
6 |
Correct |
11 ms |
2900 KB |
Output is correct |
7 |
Correct |
12 ms |
2908 KB |
Output is correct |
8 |
Correct |
11 ms |
3108 KB |
Output is correct |
9 |
Correct |
11 ms |
2908 KB |
Output is correct |
10 |
Correct |
13 ms |
3112 KB |
Output is correct |
11 |
Correct |
18 ms |
2908 KB |
Output is correct |
12 |
Correct |
19 ms |
2864 KB |
Output is correct |
13 |
Correct |
17 ms |
3116 KB |
Output is correct |
14 |
Correct |
17 ms |
3116 KB |
Output is correct |
15 |
Correct |
18 ms |
2904 KB |
Output is correct |
16 |
Correct |
16 ms |
3420 KB |
Output is correct |
17 |
Correct |
16 ms |
3372 KB |
Output is correct |
18 |
Correct |
15 ms |
3280 KB |
Output is correct |
19 |
Correct |
32 ms |
4512 KB |
Output is correct |
20 |
Correct |
34 ms |
4696 KB |
Output is correct |
21 |
Correct |
35 ms |
4656 KB |
Output is correct |
22 |
Execution timed out |
3096 ms |
4244 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
12 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2908 KB |
Output is correct |
4 |
Correct |
13 ms |
2904 KB |
Output is correct |
5 |
Correct |
12 ms |
2908 KB |
Output is correct |
6 |
Correct |
11 ms |
2900 KB |
Output is correct |
7 |
Correct |
12 ms |
2908 KB |
Output is correct |
8 |
Correct |
11 ms |
3108 KB |
Output is correct |
9 |
Correct |
11 ms |
2908 KB |
Output is correct |
10 |
Correct |
13 ms |
3112 KB |
Output is correct |
11 |
Correct |
18 ms |
2908 KB |
Output is correct |
12 |
Correct |
19 ms |
2864 KB |
Output is correct |
13 |
Correct |
17 ms |
3116 KB |
Output is correct |
14 |
Correct |
17 ms |
3116 KB |
Output is correct |
15 |
Correct |
18 ms |
2904 KB |
Output is correct |
16 |
Correct |
16 ms |
3420 KB |
Output is correct |
17 |
Correct |
16 ms |
3372 KB |
Output is correct |
18 |
Correct |
15 ms |
3280 KB |
Output is correct |
19 |
Correct |
32 ms |
4512 KB |
Output is correct |
20 |
Correct |
34 ms |
4696 KB |
Output is correct |
21 |
Correct |
35 ms |
4656 KB |
Output is correct |
22 |
Execution timed out |
3096 ms |
4244 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |