結果
| 問題 |
No.2930 Larger Mex
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-07 13:26:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 549 bytes |
| コンパイル時間 | 369 ms |
| コンパイル使用メモリ | 82,904 KB |
| 実行使用メモリ | 161,164 KB |
| 最終ジャッジ日時 | 2025-02-07 13:27:00 |
| 合計ジャッジ時間 | 13,471 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 46 RE * 4 |
ソースコード
from collections import defaultdict
import itertools
n,m=map(int,input().split())
A=list(map(int,input().split()))
l,r=0,0
ans=[0]*(n+1)
S=set()
D=defaultdict(int)
while r<=n:
if len(S)==m:
ans[r-l-1]+=1
ans[n-l]-=1
if A[l]<m:
D[A[l]]-=1
if D[A[l]]==0:
S.remove(A[l])
l+=1
elif len(S)<m:
if r==n:
break
if A[r]<m:
S.add(A[r])
D[A[r]]+=1
r+=1
ans=list(itertools.accumulate(ans))
for i in ans[:-1]:
print(i)