結果
| 問題 | No.2694 The Early Bird Catches The Worm |
| コンテスト | |
| ユーザー |
MM
|
| 提出日時 | 2024-09-15 16:38:25 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 535 ms / 2,000 ms |
| + 975µs | |
| コード長 | 802 bytes |
| 記録 | |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 21,280 KB |
| 実行使用メモリ | 63,680 KB |
| 最終ジャッジ日時 | 2026-08-28 03:36:32 |
| 合計ジャッジ時間 | 31,803 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
N, H = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cumsum = [0] * (N + 1)
B_cumsum = [0] * (N + 1)
B_cumsum_weighted = [0] * (N + 1)
for i in range(1, N + 1):
A_cumsum[i] = A_cumsum[i - 1] + A[i - 1]
B_cumsum[i] = B_cumsum[i - 1] + B[i - 1]
B_cumsum_weighted[i] = B_cumsum_weighted[i - 1] + i * B[i - 1]
max_satisfaction = 0
L = 1
for R in range(1, N + 1):
while L <= R:
fatigue = (B_cumsum_weighted[R] - B_cumsum_weighted[L - 1]) - (L - 1) * (B_cumsum[R] - B_cumsum[L - 1])
if fatigue <= H:
break
L += 1
if L > R:
continue
satisfaction = A_cumsum[R] - A_cumsum[L - 1]
if satisfaction > max_satisfaction:
max_satisfaction = satisfaction
print(max_satisfaction)
MM