結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー ypww
提出日時 2024-02-15 22:44:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 48,884 KB
最終ジャッジ日時 2024-09-28 22:33:26
合計ジャッジ時間 24,274 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 71 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

# WA 解法、不等号のミス
n,h = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

suma = [0]
for i in range(n):
    suma.append(suma[-1]+a[i])

sumb = [0]
for i in range(n):
    sumb.append(sumb[-1]+b[i])

now = 0
r = 0
ans = 0
for l in range(n):
    if l!=0:
        now -= sumb[r] - sumb[l-1]
    # 本来は <= の部分を < にした
    while r<n and now + (r-l+1)*b[r] < h:
        now += (r-l+1) * b[r]
        r += 1
    ans = max(ans, suma[r] - suma[l])

print(ans)
0