結果

問題 No.3604 Min of Max of Div of Sum
コンテスト
ユーザー Kude
提出日時 2026-07-31 22:02:55
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 309 ms / 2,000 ms
+ 344µs
コード長 590 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 95,984 KB
実行使用メモリ 273,124 KB
最終ジャッジ日時 2026-07-31 22:03:16
合計ジャッジ時間 6,358 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate
n = int(input())
a = list(accumulate(map(int, input().split()), initial=0))
b = list(accumulate(map(int, input().split()), initial=0))
l = 0
r = a[n] + 1.0
while True:
    c = (l + r) / 2
    if not l < c < r:
        break
    d = [x - c * y for x, y in zip(a, b)]
    mns = d[:]
    for i in range(n):
        mns[i+1] = min(mns[i], d[i])
    mx = d[n]
    ok = True
    for i in range(n)[::-1]:
        if mns[i] > mx:
            ok = False
            break
        mx = max(mx, d[i])
    if ok:
        l = c
    else:
        r = c
print(f'{l:.10f}')
0