結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー |
👑 |
提出日時 | 2024-03-22 21:32:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 82,056 KB |
実行使用メモリ | 145,752 KB |
最終ジャッジ日時 | 2024-09-30 10:57:35 |
合計ジャッジ時間 | 10,382 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 72 |
ソースコード
n, h = map(int, input().split())A = list(map(int, input().split()))B = list(map(int, input().split()))cum = [0]for b in B:cum.append(cum[-1] + b)ans = 0r = 0tot = 0ca = 0for l in range(n):while r < n:ntot = tot + B[r] * (r - l + 1)if ntot > h:breaktot = ntotca += A[r]r += 1ans = max(ans, ca)ca -= A[l]tot -= cum[r] - cum[l]print(ans)