結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
dp_ijk
|
| 提出日時 | 2024-03-23 05:12:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 81,988 KB |
| 実行使用メモリ | 138,028 KB |
| 最終ジャッジ日時 | 2024-09-30 13:04:04 |
| 合計ジャッジ時間 | 10,735 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
from itertools import accumulate
N, H = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
A_wa = [0] + [*accumulate(A)]
B_wa = [0] + [*accumulate(B)]
r = 0
cost = 0
cands = []
for l in range(N+1):
if r < l:
r = l
cost = 0
while r < N and cost + (r-l+1) * B[r] <= H:
cost += (r-l+1) * B[r]
r += 1
cands.append(A_wa[r] - A_wa[l])
cost -= (B_wa[r] - B_wa[l])
print(max(cands))
dp_ijk