結果
問題 | No.2930 Larger Mex |
ユーザー |
![]() |
提出日時 | 2024-09-09 16:07:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 164 ms / 2,000 ms |
コード長 | 819 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 122,376 KB |
最終ジャッジ日時 | 2024-10-12 06:39:21 |
合計ジャッジ時間 | 9,024 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
n,m = map(int, input().split())A = list(map(int, input().split()))cnt = {}if(m==0):for i in range(n):print(n-i)exit()def add(x):if(x >= m):returnif(x not in cnt):cnt[x] = 0cnt[x] += 1def remove(x):if(x >= m):returncnt[x] -= 1if(cnt[x] == 0):del cnt[x]B = [0]*n# 開区間[l, r)l = 0r = 0while l < n:if(len(cnt) == m):# print(A[l:r])# imosa = r-lb = a + (n-r)B[a-1] += 1if(b < n): B[b] -= 1# print(a,b)remove(A[l])l += 1else:if(r == n):breakadd(A[r])r += 1CB = [0]for i in range(n):CB.append(CB[-1] + B[i])for ans in CB[1:]:print(ans)