結果

問題 No.1148 土偶Ⅲ
ユーザー 37zigen37zigen
提出日時 2020-08-07 20:27:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 17,220 KB
最終ジャッジ日時 2023-10-24 22:42:06
合計ジャッジ時間 5,423 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,128 KB
testcase_01 AC 26 ms
10,128 KB
testcase_02 AC 26 ms
10,128 KB
testcase_03 AC 26 ms
10,128 KB
testcase_04 AC 26 ms
10,128 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 77 ms
10,236 KB
testcase_24 AC 104 ms
10,404 KB
testcase_25 AC 114 ms
10,404 KB
testcase_26 AC 351 ms
10,928 KB
testcase_27 AC 68 ms
10,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w=map(int,input().split())
a=[int(input()) for _ in range(n)]
cnt={}
for v in a:
    cnt[v]=0
t=0
ans=0
sum=0
for s in range(n):
    while t<n and sum+a[t]<=w and cnt[a[t]]==0:
        sum+=a[t]
        cnt[a[t]]=1
        t+=1
    ans=max(ans,t-s)
    sum-=a[s]
    cnt[a[s]]-=1
print(ans)
0