結果
問題 |
No.2930 Larger Mex
|
ユーザー |
![]() |
提出日時 | 2024-10-12 16:59:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 141,016 KB |
最終ジャッジ日時 | 2024-10-12 16:59:54 |
合計ジャッジ時間 | 10,487 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 46 WA * 4 |
ソースコード
n, m = map(int, input().split()) a = list(map(int, input().split())) tmp = [0]*(n+1) cnt = [0]*(m+2) d = set() r = 0 for i in range(n): while len(d) < m and r < n: if a[r] < m: cnt[a[r]] += 1 d.add(a[r]) r += 1 if len(d) == m: tmp[r-i-1] += 1 tmp[n-i] -= 1 if a[i] < m: cnt[a[i]] -= 1 if cnt[a[i]] == 0: d.discard(a[i]) import itertools acc = list(itertools.accumulate(tmp)) print(*acc[:-1], sep='\n')