func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, A[100001], Ans[100001];   bool k[100001];   int solve(int x) {     if (Ans[x]) return Ans[x];     int tmp = 0, cnt = 0, pre = 1;     for (int i = 1; i <= n; i++) {       if (!k[A[i]]) {         if (cnt == x) {           tmp++;           cnt = 1;           for (int j = pre; j < i; j++) {             k[A[j]] = 0;           }           pre = i;           k[A[i]] = 1;         } else {           cnt++;           k[A[i]] = 1;         }       }     }     if (cnt) {       tmp++;       for (int i = pre; i <= n; i++) k[A[i]] = 0;     }     return Ans[x] = tmp;   }   void work(int x, int y) {     int l = solve(x), r = solve(y);     if (l == r) {       for (int i = x; i <= y; i++) {         Ans[i] = l;       }       return;     }     int mid = (x + y) / 2;     work(x, mid);     work(mid + 1, y);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &A[i]);     work(1, n);     for (int i = 1; i <= n; i++) printf( %d  , Ans[i]);   }   