結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2024-03-22 21:40:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 173 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 266 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 133,812 KB |
| 最終ジャッジ日時 | 2024-09-30 11:08:10 |
| 合計ジャッジ時間 | 11,035 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
N, H = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
Bc = [0] * (N + 1)
for i in range(N):
Bc[i + 1] = Bc[i] + B[i]
from collections import *
Q = deque()
v, ans, temp = 0, 0, 0
for i in range(N):
Q.append(i)
v += len(Q) * B[i]
temp += A[i]
while v > H:
ind = Q.popleft()
v -= Bc[i + 1] - Bc[ind]
temp -= A[ind]
ans = max(ans, temp)
print(ans)
rlangevin