結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-19 10:45:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 594 bytes |
| コンパイル時間 | 513 ms |
| コンパイル使用メモリ | 83,008 KB |
| 実行使用メモリ | 127,080 KB |
| 最終ジャッジ日時 | 2025-06-19 10:45:24 |
| 合計ジャッジ時間 | 13,749 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 45 TLE * 1 -- * 26 |
ソースコード
from collections import deque
n, h = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxv = 0
q = deque()
curr_tired = 0
satisfaction = 0
for i in range(n):
q.append((a[i], b[i]))
satisfaction += a[i]
curr_tired += b[i]
tired = sum((j + 1) * item[1] for j, item in enumerate(q))
while tired > h and q:
removed = q.popleft()
satisfaction -= removed[0]
curr_tired -= removed[1]
tired = sum((j + 1) * item[1] for j, item in enumerate(q))
maxv = max(maxv, satisfaction)
print(maxv)