結果
問題 | No.1148 土偶Ⅲ |
ユーザー | 👑 Kazun |
提出日時 | 2021-02-14 17:39:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 366 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 87,056 KB |
実行使用メモリ | 78,020 KB |
最終ジャッジ日時 | 2023-09-29 09:11:55 |
合計ジャッジ時間 | 5,047 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,512 KB |
testcase_01 | WA | - |
testcase_02 | AC | 73 ms
71,224 KB |
testcase_03 | AC | 76 ms
71,232 KB |
testcase_04 | AC | 71 ms
71,216 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 | 89 ms
76,524 KB |
testcase_24 | AC | 91 ms
76,760 KB |
testcase_25 | AC | 93 ms
76,796 KB |
testcase_26 | AC | 108 ms
77,764 KB |
testcase_27 | AC | 87 ms
76,628 KB |
ソースコード
import sys input=sys.stdin.readline N,W=map(int,input().split()) A=[0]*N for i in range(N): A[i]=int(input()) Set=set() Total=0 X=0 R=0 for L in range(N): while R<N and (Total+A[R]<=W) and (A[R] not in Set): Total+=A[R] Set.add(A[R]) R+=1 X=max(X,R-L) Total-=A[L] Set.discard(A[L]) if L==R: R+=1 print(X)