結果
問題 |
No.3269 Leq-K Partition
|
ユーザー |
![]() |
提出日時 | 2025-09-12 22:28:16 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 996 bytes |
コンパイル時間 | 384 ms |
コンパイル使用メモリ | 82,420 KB |
実行使用メモリ | 99,272 KB |
最終ジャッジ日時 | 2025-09-12 23:42:30 |
合計ジャッジ時間 | 8,598 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 1 -- * 21 |
ソースコード
N = int(input()) A = list(map(int, input().split())) if N == 1: exit(print(1)) F = [False]*N def func(k): ans = 0 cnt = 0 history = [] for a in A: if not F[a-1]: if cnt == k: ans += 1 while history: h = history.pop() F[h] = False cnt = 0 cnt += 1 F[a-1] = True history.append(a-1) while history: h = history.pop() F[h] = False return ans+1 route = int(N**0.6)+1 ans = [] for k in range(1, route+1): ans.append(func(k)) left = route while left <= N: now = ans[-1] idx = len(ans) right = N+1 while left+1 < right: mid = (left+right)//2 if func(mid) == now: left = mid else: right = mid for _ in range(right-idx-1): ans.append(now) if right <= N: ans.append(func(right)) left = right for a in ans: print(a)