結果
問題 |
No.2694 The Early Bird Catches The Worm
|
ユーザー |
![]() |
提出日時 | 2024-05-22 00:26:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 780 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 81,992 KB |
実行使用メモリ | 150,784 KB |
最終ジャッジ日時 | 2024-12-20 18:18:48 |
合計ジャッジ時間 | 15,251 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 8 WA * 7 RE * 57 |
ソースコード
def max_satisfaction(N, H, A, B): max_satisfaction = 0 current_fatigue = 0 current_satisfaction = 0 left = 0 for right in range(N): current_satisfaction += A[right] current_fatigue += B[right] * (right - left + 1) while current_fatigue > H: current_fatigue -= B[left] * (right - left + 1) left += 1 current_satisfaction -= A[left - 1] max_satisfaction = max(max_satisfaction, current_satisfaction) return max_satisfaction # Input reading import sys input = sys.stdin.read data = input().split() N = int(data[0]) H = int(data[1]) A = list(map(int, data[2:N+2])) B = list(map(int, data[N+2:2*N+2])) result = max_satisfaction(N, H, A, B) print(result)