結果

問題 No.2601 Very Poor
ユーザー minimum
提出日時 2024-01-12 21:35:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 111,488 KB
最終ジャッジ日時 2024-09-27 21:29:16
合計ジャッジ時間 4,346 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 and now + B[r] <= X:
        now += B[r]
        r += 1
    ans = max(ans, now)
    now -= B[l]

print(ans)
0