結果

問題 No.2601 Very Poor
ユーザー titiatitia
提出日時 2024-02-28 02:31:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,222 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 32,020 KB
最終ジャッジ日時 2024-03-20 19:54:52
合計ジャッジ時間 26,367 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 32 ms
9,984 KB
testcase_02 AC 31 ms
9,984 KB
testcase_03 AC 30 ms
9,984 KB
testcase_04 AC 29 ms
9,984 KB
testcase_05 AC 41 ms
10,368 KB
testcase_06 AC 41 ms
10,368 KB
testcase_07 AC 42 ms
10,368 KB
testcase_08 AC 41 ms
10,368 KB
testcase_09 AC 41 ms
10,368 KB
testcase_10 AC 41 ms
10,368 KB
testcase_11 AC 41 ms
10,368 KB
testcase_12 AC 41 ms
10,368 KB
testcase_13 AC 41 ms
10,368 KB
testcase_14 AC 41 ms
10,368 KB
testcase_15 AC 1,204 ms
32,020 KB
testcase_16 AC 1,173 ms
32,020 KB
testcase_17 AC 1,187 ms
32,020 KB
testcase_18 AC 1,192 ms
32,020 KB
testcase_19 AC 1,155 ms
32,020 KB
testcase_20 AC 1,208 ms
32,020 KB
testcase_21 AC 1,165 ms
32,020 KB
testcase_22 AC 1,191 ms
32,020 KB
testcase_23 AC 1,180 ms
32,020 KB
testcase_24 AC 1,184 ms
32,020 KB
testcase_25 AC 1,181 ms
32,020 KB
testcase_26 AC 1,196 ms
32,020 KB
testcase_27 AC 1,201 ms
32,020 KB
testcase_28 AC 1,210 ms
32,020 KB
testcase_29 AC 1,199 ms
32,020 KB
testcase_30 AC 1,161 ms
32,020 KB
testcase_31 AC 1,222 ms
32,020 KB
testcase_32 AC 1,183 ms
32,020 KB
testcase_33 AC 1,216 ms
32,020 KB
testcase_34 AC 1,220 ms
32,020 KB
testcase_35 AC 37 ms
10,368 KB
testcase_36 AC 41 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    ind=max(ind,i)
    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