제출 #719728

#제출 시각아이디문제언어결과실행 시간메모리
719728BoomydayBalloons (CEOI11_bal)Pypy 3
100 / 100
886 ms42508 KiB
from collections import deque

n = int(input())

x, r = [], []



def getrj(ri, xi, xj):
    return (xj-xi)/(4*ri)*(xj-xi)

assert (getrj(9, 0, 13)) - 4.694 <= 0.001


for i in range(n):
    xi, ri = map(int, input().split())
    x.append(xi)
    r.append(ri)






st = deque()
r2 = []

for bal in range(n):
    mn = r[bal]
    while st:
        tp = st.pop()
        mn = min(mn, getrj(r2[tp], x[tp], x[bal]))
        if mn >= r2[tp]:
            continue
        else:
            st.append(tp)
            break

    st.append(bal)




    print(mn)
    r2.append(mn)

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...