結果
| 問題 |
No.2601 Very Poor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-16 11:34:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 487 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 29,588 KB |
| 最終ジャッジ日時 | 2024-09-28 02:28:16 |
| 合計ジャッジ時間 | 7,116 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 2 |
ソースコード
def solve(n, x, a): if n == 1: return a[0] if a[0] <= x else 0 ans = 0 r = 1 s = 0 for l in range(1, n - 1): while r < n - 1 and s + a[r] <= x: s += a[r] r += 1 if s <= x: ans = max(s, ans) s -= a[l] r = 0 s = sum(a) for l in range(n): while r <= l and s + a[r] <= x: s += a[r] r += 1 if s <= x: ans = max(s, ans) s -= a[l] return ans n, x = [int(y) for y in input().split()] a = [int(y) for y in input().split()] print(solve(n, x, a))