結果

問題 No.2601 Very Poor
ユーザー minimum
提出日時 2024-01-12 21:33:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 111,476 KB
最終ジャッジ日時 2024-09-27 21:26:22
合計ジャッジ時間 4,756 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int, input().split())
A = list(map(int, input().split()))
B = A + A

r = 0
now = 0
ans = 0
for l in range(2 * N):
    while l > r:
        now += B[r]
        r += 1
    while r < 2 * N - 1 and now + B[r] <= X:
        now += B[r]
        r += 1
    ans = max(ans, now)
    now -= B[l]

print(ans)
0