結果
問題 | No.2930 Larger Mex |
ユーザー |
👑 |
提出日時 | 2024-09-09 16:17:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 277 ms / 2,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,416 KB |
実行使用メモリ | 164,904 KB |
最終ジャッジ日時 | 2024-10-12 06:39:12 |
合計ジャッジ時間 | 11,309 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
from collections import Counterfrom itertools import accumulateN, 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 = 0for l in range(N):while r < N and len(not_exist) >= 1:cntr[A[r]] += 1not_exist.discard(A[r])r += 1if len(not_exist) == 0:imos[r - l] += 1imos[N - l + 1] -= 1cntr[A[l]] -= 1if 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])