func_code_string: #include <bits/stdc++.h>   using namespace std;   int T[5000000], sl[5000000], sr[5000000], a[200005], rt[200005], la[200005],       pos[200005];   int i, j, n, num, tmp, ans;   void build(int l, int r, int &node) {     node = ++num;     if (l == r) return;     int mid = (l + r) >> 1;     build(l, mid, sl[node]);     build(mid + 1, r, sr[node]);   }   void Insert(int l, int r, int x, int y, int node) {     int k = ++num;     if (l == r) {       T[k] = T[node] + y;       return;     }     int mid = (l + r) >> 1;     if (x <= mid) {       sl[k] = num + 1, sr[k] = sr[node];       Insert(l, mid, x, y, sl[node]);     } else {       sl[k] = sl[node], sr[k] = num + 1;       Insert(mid + 1, r, x, y, sr[node]);     }     T[k] = T[sl[k]] + T[sr[k]];   }   int ask(int l, int r, int k, int node) {     if (l == r) return l;     int mid = (l + r) >> 1, now = T[sl[node]];     if (now >= k) return ask(l, mid, k, sl[node]);     return ask(mid + 1, r, k - now, sr[node]);   }   int main() {     scanf( %d , &n);     for (i = 1; i <= n; i++) scanf( %d , &a[i]);     build(1, n + 1, rt[0]);     rt[1] = num + 1, Insert(1, n + 1, n + 1, 1, rt[0]);     tmp = 1;     for (i = n; i; i--) {       if (pos[a[i]])         rt[tmp + 1] = num + 1, Insert(1, n + 1, pos[a[i]], -1, rt[tmp++]);       rt[tmp + 1] = num + 1, Insert(1, n + 1, i, 1, rt[tmp++]);       la[i] = tmp;       pos[a[i]] = i;     }     for (i = 1; i <= n; i++) {       ans = 0;       j = 1;       while ((j = ask(1, n + 1, i + 1, rt[la[j]])) <= n) ans++;       printf( %d  , ans + 1);     }     return 0;   }   