結果
問題 | No.2930 Larger Mex |
ユーザー |
|
提出日時 | 2024-09-07 05:31:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 338 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 109,312 KB |
最終ジャッジ日時 | 2024-10-12 06:39:01 |
合計ジャッジ時間 | 8,763 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
n,m=map(int,input().split())a=list(map(int,input().split()))val,r,cnt,res=0,0,[0]*m,[0]*(n+2)for i in range(n):r=max(r,i)while r<n and val<m:if a[r]<m:if cnt[a[r]]==0:val+=1cnt[a[r]]+=1r+=1if val==m:res[r-i]+=1res[n+1-i]-=1if i<r and a[i]<m:if cnt[a[i]]==1:val-=1cnt[a[i]]-=1for i in range(n):res[i+1]+=res[i]print(res[i+1])