結果
問題 |
No.1148 土偶Ⅲ
|
ユーザー |
👑 ![]() |
提出日時 | 2021-02-14 17:41:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 383 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 82,352 KB |
実行使用メモリ | 76,796 KB |
最終ジャッジ日時 | 2024-07-22 03:51:37 |
合計ジャッジ時間 | 3,092 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
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) if L==R: R+=1 else: Total-=A[L] Set.discard(A[L]) print(X)