結果
| 問題 |
No.3269 Leq-K Partition
|
| コンテスト | |
| ユーザー |
apricity
|
| 提出日時 | 2025-08-03 14:27:24 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 809 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 85,532 KB |
| 実行使用メモリ | 11,300 KB |
| 最終ジャッジ日時 | 2025-08-11 21:54:20 |
| 合計ジャッジ時間 | 9,389 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 TLE * 1 -- * 21 |
ソースコード
#pragma GCC optimize("Ofast,unroll-loops")
#include <iostream>
using namespace std;
constexpr int MX = 1000000;
int n;
int a[MX];
bool vis[MX];
int calc(int k) {
int pre = 0;
int res = 0;
int distinct = k;
for (int i = 0; i < n; i++) {
if (not vis[a[i]]) {
if (distinct == k) {
res++;
for (int j = pre; j < i; j++) vis[a[j]] = false;
distinct = 1;
pre = i;
}
else {
distinct++;
}
vis[a[i]] = true;
}
}
for (int i = pre; i < n; i++) vis[a[i]] = false;
return res;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i]; a[i]--;
}
for (int i = 1; i <= n; i++) cout << calc(i) << "\n";
}
apricity