이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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 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... |