結果

問題 No.2601 Very Poor
ユーザー titiatitia
提出日時 2024-01-12 21:33:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 357 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 31,888 KB
最終ジャッジ日時 2024-02-27 19:05:53
合計ジャッジ時間 22,038 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,856 KB
testcase_01 AC 27 ms
9,856 KB
testcase_02 AC 27 ms
9,856 KB
testcase_03 AC 28 ms
9,856 KB
testcase_04 AC 30 ms
9,856 KB
testcase_05 AC 39 ms
10,240 KB
testcase_06 AC 37 ms
10,240 KB
testcase_07 AC 39 ms
10,240 KB
testcase_08 AC 38 ms
10,240 KB
testcase_09 AC 38 ms
10,240 KB
testcase_10 AC 37 ms
10,240 KB
testcase_11 AC 39 ms
10,240 KB
testcase_12 AC 37 ms
10,240 KB
testcase_13 AC 37 ms
10,240 KB
testcase_14 AC 38 ms
10,240 KB
testcase_15 AC 986 ms
31,888 KB
testcase_16 AC 989 ms
31,888 KB
testcase_17 AC 1,004 ms
31,888 KB
testcase_18 AC 982 ms
31,888 KB
testcase_19 AC 1,028 ms
31,888 KB
testcase_20 AC 988 ms
31,888 KB
testcase_21 AC 990 ms
31,888 KB
testcase_22 AC 994 ms
31,888 KB
testcase_23 AC 1,022 ms
31,888 KB
testcase_24 AC 981 ms
31,888 KB
testcase_25 AC 991 ms
31,888 KB
testcase_26 AC 990 ms
31,888 KB
testcase_27 AC 985 ms
31,888 KB
testcase_28 AC 975 ms
31,888 KB
testcase_29 AC 994 ms
31,888 KB
testcase_30 AC 1,002 ms
31,888 KB
testcase_31 AC 1,011 ms
31,888 KB
testcase_32 AC 991 ms
31,888 KB
testcase_33 AC 996 ms
31,888 KB
testcase_34 AC 975 ms
31,888 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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

A=A+A+A

Q=deque()
ANS=0

ind=0
SUM=0
for i in range(3*N):
    while ind<len(A) and SUM+A[ind]<=X and len(Q)<=N-1:
        Q.append(A[ind])
        SUM+=A[ind]
        ind+=1

    ANS=max(ANS,SUM)

    if Q:
        x=Q.popleft()
        SUM-=x

print(ANS)
    

0