This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |