結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
sharu
|
| 提出日時 | 2024-03-23 01:38:21 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 572 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 43,068 KB |
| 最終ジャッジ日時 | 2024-09-30 12:59:54 |
| 合計ジャッジ時間 | 22,929 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
n, h = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
s = [0]
for i in range(n):
s.append(s[i] + B[i])
ans = 0
a = 0
b = 0
r = 0
for l in range(n):
while r < n and b + (r - l + 1) * B[r] <= h:
b += (r - l + 1) * B[r]
a += A[r]
r += 1
if b <= h:
ans = max(ans, a)
if l == r:
r += 1
else:
b -= s[r] - s[l]
a -= A[l]
print(ans)
sharu