Submission #953652

# Submission time Handle Problem Language Result Execution time Memory
953652 2024-03-26T11:55:25 Z ayeshz Circle selection (APIO18_circle_selection) PyPy 3
7 / 100
3000 ms 98612 KB
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)))
# Verdict Execution time Memory Grader output
1 Correct 28 ms 18228 KB Output is correct
2 Correct 28 ms 18236 KB Output is correct
3 Correct 28 ms 18228 KB Output is correct
4 Correct 30 ms 18184 KB Output is correct
5 Correct 28 ms 18228 KB Output is correct
6 Correct 31 ms 18236 KB Output is correct
7 Correct 30 ms 18236 KB Output is correct
8 Correct 38 ms 18340 KB Output is correct
9 Correct 31 ms 18428 KB Output is correct
10 Correct 30 ms 18228 KB Output is correct
11 Correct 39 ms 18988 KB Output is correct
12 Correct 37 ms 19000 KB Output is correct
13 Correct 37 ms 18992 KB Output is correct
14 Correct 37 ms 18992 KB Output is correct
15 Correct 37 ms 18992 KB Output is correct
16 Correct 57 ms 19760 KB Output is correct
17 Correct 55 ms 19352 KB Output is correct
18 Correct 53 ms 19500 KB Output is correct
19 Correct 83 ms 24000 KB Output is correct
20 Correct 81 ms 23852 KB Output is correct
21 Correct 103 ms 25136 KB Output is correct
22 Correct 353 ms 24452 KB Output is correct
23 Correct 348 ms 24536 KB Output is correct
24 Correct 346 ms 25112 KB Output is correct
25 Correct 353 ms 24680 KB Output is correct
26 Correct 331 ms 24312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1176 ms 98152 KB Output is correct
2 Correct 1180 ms 98612 KB Output is correct
3 Correct 1183 ms 92452 KB Output is correct
4 Correct 1146 ms 98188 KB Output is correct
5 Execution timed out 3062 ms 84964 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 18236 KB Output is correct
2 Execution timed out 3086 ms 42456 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 86332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 18228 KB Output is correct
2 Correct 28 ms 18236 KB Output is correct
3 Correct 28 ms 18228 KB Output is correct
4 Correct 30 ms 18184 KB Output is correct
5 Correct 28 ms 18228 KB Output is correct
6 Correct 31 ms 18236 KB Output is correct
7 Correct 30 ms 18236 KB Output is correct
8 Correct 38 ms 18340 KB Output is correct
9 Correct 31 ms 18428 KB Output is correct
10 Correct 30 ms 18228 KB Output is correct
11 Correct 39 ms 18988 KB Output is correct
12 Correct 37 ms 19000 KB Output is correct
13 Correct 37 ms 18992 KB Output is correct
14 Correct 37 ms 18992 KB Output is correct
15 Correct 37 ms 18992 KB Output is correct
16 Correct 57 ms 19760 KB Output is correct
17 Correct 55 ms 19352 KB Output is correct
18 Correct 53 ms 19500 KB Output is correct
19 Correct 83 ms 24000 KB Output is correct
20 Correct 81 ms 23852 KB Output is correct
21 Correct 103 ms 25136 KB Output is correct
22 Correct 353 ms 24452 KB Output is correct
23 Correct 348 ms 24536 KB Output is correct
24 Correct 346 ms 25112 KB Output is correct
25 Correct 353 ms 24680 KB Output is correct
26 Correct 331 ms 24312 KB Output is correct
27 Correct 99 ms 26124 KB Output is correct
28 Correct 97 ms 25732 KB Output is correct
29 Correct 93 ms 25564 KB Output is correct
30 Correct 1370 ms 25648 KB Output is correct
31 Correct 1405 ms 25696 KB Output is correct
32 Correct 1453 ms 25384 KB Output is correct
33 Correct 360 ms 45524 KB Output is correct
34 Correct 359 ms 45504 KB Output is correct
35 Correct 385 ms 45344 KB Output is correct
36 Execution timed out 3068 ms 41992 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 18228 KB Output is correct
2 Correct 28 ms 18236 KB Output is correct
3 Correct 28 ms 18228 KB Output is correct
4 Correct 30 ms 18184 KB Output is correct
5 Correct 28 ms 18228 KB Output is correct
6 Correct 31 ms 18236 KB Output is correct
7 Correct 30 ms 18236 KB Output is correct
8 Correct 38 ms 18340 KB Output is correct
9 Correct 31 ms 18428 KB Output is correct
10 Correct 30 ms 18228 KB Output is correct
11 Correct 39 ms 18988 KB Output is correct
12 Correct 37 ms 19000 KB Output is correct
13 Correct 37 ms 18992 KB Output is correct
14 Correct 37 ms 18992 KB Output is correct
15 Correct 37 ms 18992 KB Output is correct
16 Correct 57 ms 19760 KB Output is correct
17 Correct 55 ms 19352 KB Output is correct
18 Correct 53 ms 19500 KB Output is correct
19 Correct 83 ms 24000 KB Output is correct
20 Correct 81 ms 23852 KB Output is correct
21 Correct 103 ms 25136 KB Output is correct
22 Correct 353 ms 24452 KB Output is correct
23 Correct 348 ms 24536 KB Output is correct
24 Correct 346 ms 25112 KB Output is correct
25 Correct 353 ms 24680 KB Output is correct
26 Correct 331 ms 24312 KB Output is correct
27 Correct 1176 ms 98152 KB Output is correct
28 Correct 1180 ms 98612 KB Output is correct
29 Correct 1183 ms 92452 KB Output is correct
30 Correct 1146 ms 98188 KB Output is correct
31 Execution timed out 3062 ms 84964 KB Time limit exceeded
32 Halted 0 ms 0 KB -