結果
| 問題 | No.2694 The Early Bird Catches The Worm | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-06-19 11:10:30 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 429 bytes | 
| コンパイル時間 | 605 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 42,768 KB | 
| 最終ジャッジ日時 | 2025-06-19 11:10:57 | 
| 合計ジャッジ時間 | 24,396 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 15 WA * 57 | 
ソースコード
n, h = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxv, sat, tired, r = 0, 0, 0, 0
for l in range(n):
    
    while r < n and tired + (r - l + 1) * b[r] <= h:
        tired += (r - l + 1) * b[r]  
        sat += a[r]  
        r += 1
 
    maxv = max(maxv, sat)
    if r > l:
        tired -= b[l] * (r - l)  
        sat -= a[l]
    else:
        r += 1  
print(maxv)
            
            
            
        