結果

問題 No.2009 Drunkers' Contest
ユーザー tktk_snsn
提出日時 2022-07-15 22:21:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 43,180 KB
最終ジャッジ日時 2024-06-27 18:48:08
合計ジャッジ時間 23,719 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

P = []
Q = []
for a, b in zip(A, B):
    while P and max(P[-1] * Q[-1], P[-1] + Q[-1]) >= max(a * b, a + b):
        a += P.pop()
        b += Q.pop()
    P.append(a)
    Q.append(b)

ans = 0
for p, q in zip(P, Q):
    x = 0
    if p > q:
        x = (p / q) ** .5 - 1
    ans += p / (1 + x)
    ans += q * (1 + x)

print("{:.13f}".format(ans))
0