結果

問題 No.2601 Very Poor
コンテスト
ユーザー 👑 amentorimaru
提出日時 2023-11-02 02:11:38
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 454 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 338 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 113,152 KB
最終ジャッジ日時 2026-04-16 11:12:43
合計ジャッジ時間 5,548 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
def read_values(): return tuple(map(int, input().split()))
def read_list(): return list(map(int, input().split()))


def main():  
    n,x=read_values()
    a=read_list()
    ans=0
    a=a+a
    l=0
    t=0
    for i in range(n*2):
        t+=a[i]
        while t>x or i-l>=n:
            t-=a[l]
            l+=1
        ans=max(ans,t)
    print(ans)
            
            
if __name__ == "__main__":
    main()
0