結果
| 問題 | No.2694 The Early Bird Catches The Worm |
| コンテスト | |
| ユーザー |
mo124121
|
| 提出日時 | 2024-02-16 01:02:22 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 349 ms / 2,000 ms |
| + 630µs | |
| コード長 | 475 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 14,464 KB |
| 実行使用メモリ | 41,688 KB |
| 最終ジャッジ日時 | 2026-10-16 17:59:44 |
| 合計ジャッジ時間 | 20,493 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 73 |
ソースコード
from collections import deque
N, H = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
q = deque()
ans = 0
fatigue = 0
cum = 0
score = 0
for a, b in reversed(list(zip(A, B))):
score += a
cum += b
fatigue += cum
q.appendleft((a, b))
while fatigue > H:
aprev, bprev = q.pop()
score -= aprev
cum -= bprev
fatigue -= bprev * (len(q) + 1)
ans = max(ans, score)
print(ans)
mo124121