結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-19 10:44:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 594 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 39,340 KB |
| 最終ジャッジ日時 | 2025-06-19 10:44:49 |
| 合計ジャッジ時間 | 18,720 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)