import random
import time
random.seed(time.time())
def solve():
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
ans = [0]*(n)
def check(i: int, j: int, r1: float, r2: float):
d = (a[i][0]-a[j][0])**2 + (r1 - r2)**2
if d < (r1+r2)**2:
return 0
return 1
def find(i: int,x: float):
ok = 1
for j in range(i):
ok &= check(j, i, ans[j], x)
return ok
for i in range(n):
l, h=0.0,a[i][1]
while h-l > float(1e-6):
mid = (l + h )/2
if find(i, mid) == 1:
ans[i]=mid
l=mid
else:
h=mid
print(*ans, sep="\n")
if __name__ == '__main__':
t = 1
# print(t)
while t > 0:
t -= 1
solve()
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
3164 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3164 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2045 ms |
3412 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2055 ms |
3572 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2044 ms |
7104 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2025 ms |
13256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
23884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2067 ms |
27128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2028 ms |
35008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2100 ms |
43008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |