func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   template <typename T>   using v = vector<T>;   const ll K = 1000;   const ll N = 1e5;   const ll B = N / K + 1;   ll n;   ll arr[N + 1];   ll cnt[N + 1];   ll bin[B + 1];   ll greedy(ll k) {     fill(begin(cnt), end(cnt), 0);     v<ll> dif;     ll bits = 0;     for (ll i = 1; i <= n; i++) {       ll val = arr[i];       if (cnt[val] == 0) {         if ((ll)dif.size() == k) {           for (const auto& color : dif) {             cnt[color] = 0;           }           dif.clear();           bits++;         }         dif.push_back(val);       }       cnt[val]++;     }     if (dif.size() > 0) {       bits++;     }     return bits;   }   int main(int argc, char const* argv[]) {     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);     cin >> n;     for (ll i = 0; i < n; i++) {       cin >> arr[i + 1];     }     v<ll> resarr(n + 1, -1);     for (ll k = 1; k <= min(K, n); k++) {       resarr[k] = greedy(k);     }     fill(begin(bin), end(bin), 1);     for (ll b = 1; b <= B; b++) {       ll lo = 1;       ll hi = (b > 1) ? bin[b - 1] : n;       while (lo != hi) {         ll mid = (lo + hi) / 2;         ll curbits = greedy(mid);         if (curbits <= b) {           hi = mid;         } else {           lo = mid + 1;         }       }       bin[b] = lo;     }     for (ll k = K + 1; k <= n; k++) {       ll lo = 1;       ll hi = resarr[k - 1];       while (lo != hi) {         ll mid = (lo + hi) / 2;         if (bin[mid] <= k) {           hi = mid;         } else {           lo = mid + 1;         }       }       resarr[k] = lo;     }     for (ll i = 1; i <= n; i++) {       cout << resarr[i] <<    ;     }     cout <<   n ;     return 0;   }   