結果
問題 |
No.2601 Very Poor
|
ユーザー |
|
提出日時 | 2024-01-13 22:46:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 109 ms / 2,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 81,992 KB |
実行使用メモリ | 111,360 KB |
最終ジャッジ日時 | 2024-09-30 06:35:32 |
合計ジャッジ時間 | 4,303 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
N,X = map(int,input().split()) A = list(map(int,input().split())) B = A + A S = sum(A) import sys if S <= X: print(S) exit() l = 0 now = 0 r = 0 ans = 0 while l < N: while r < N + N and now + B[r] <= X: now += B[r] r += 1 if now > ans: ans = now if r == l: l += 1 r += 1 else: now -= B[l] l += 1 print(ans)