結果
問題 | No.2930 Larger Mex |
ユーザー |
|
提出日時 | 2025-02-07 13:58:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 152 ms / 2,000 ms |
コード長 | 396 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 82,596 KB |
実行使用メモリ | 128,584 KB |
最終ジャッジ日時 | 2025-02-07 13:59:07 |
合計ジャッジ時間 | 10,070 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
n,m,*A=map(int,open(0).read().split())if not m:print(*range(n,0,-1),sep='\n');exit()f=[0]*m;ans=[0]*(n+1);l=r=c=0while r<=n:if c==m:ans[r-l-1]+=1;ans[n-l]-=1if A[l]<m:f[A[l]]-=1; c-=f[A[l]]==0l+=1else:if r==n:breakif A[r]<m:c+=f[A[r]]==0;f[A[r]]+=1r+=1from itertools import accumulateprint(*list(accumulate(ans))[:-1],sep='\n')