結果
| 問題 | No.3269 Leq-K Partition |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-09-12 22:28:16 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 4,654 ms / 6,000 ms |
| + 818µs | |
| コード長 | 996 bytes |
| 記録 | |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 181,624 KB |
| 最終ジャッジ日時 | 2026-07-15 00:48:53 |
| 合計ジャッジ時間 | 57,013 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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)
detteiuu