結果
| 問題 | No.2930 Larger Mex |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2024-09-09 16:17:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 260 ms / 2,000 ms |
| コード長 | 672 bytes |
| 記録 | |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 173,952 KB |
| 最終ジャッジ日時 | 2026-04-28 18:19:55 |
| 合計ジャッジ時間 | 9,387 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
from collections import Counter
from itertools import accumulate
N, M = map(int, input().split())
if M == 0:
for i in range(1, N + 1):
print(N - i + 1)
exit()
A = list(map(int, input().split()))
not_exist = set([*range(0, M)])
cntr = Counter()
imos = [0] * (N + 2)
r = 0
for l in range(N):
while r < N and len(not_exist) >= 1:
cntr[A[r]] += 1
not_exist.discard(A[r])
r += 1
if len(not_exist) == 0:
imos[r - l] += 1
imos[N - l + 1] -= 1
cntr[A[l]] -= 1
if cntr[A[l]] == 0 and A[l] < M:
not_exist.add(A[l])
imos = list(accumulate(imos))
for i in range(1, N + 1):
print(imos[i])