結果
問題 |
No.1148 土偶Ⅲ
|
ユーザー |
|
提出日時 | 2022-01-20 13:58:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 376 ms / 2,000 ms |
コード長 | 318 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 16,176 KB |
最終ジャッジ日時 | 2024-11-23 17:54:49 |
合計ジャッジ時間 | 5,901 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
from collections import defaultdict,deque n,w=map(int,input().split()) d=defaultdict(int) ans=0 now=0 q=deque() for _ in range(n): a=int(input()) now+=a q.append(a) d[a]+=1 while (d[a]>1 or now>w) and q: out=q.popleft() now-=out d[out]-=1 ans=max(ans,len(q)) print(ans)