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)
stack = []
def find(i: int, j: int):
return ((a[j][0]-a[i][0])**2) / (4*ans[j])
for i in range(n):
r = a[i][1]
while len(stack) > 0:
cr = find(i, stack[-1])
r = min(cr, r)
if r >= ans[stack[-1]]:
stack.pop()
else:
break
ans[i] = r
stack.append(i)
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 |
13 ms |
3164 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
3164 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
3164 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
3676 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
8276 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
217 ms |
16372 KB |
50000 numbers |
2 |
Correct |
223 ms |
18084 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
439 ms |
29968 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
504 ms |
33708 KB |
115362 numbers |
2 |
Correct |
519 ms |
38448 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
660 ms |
44020 KB |
154271 numbers |
2 |
Correct |
916 ms |
61996 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
877 ms |
54768 KB |
200000 numbers |
2 |
Correct |
878 ms |
61900 KB |
199945 numbers |