func_code_string: #include <bits/stdc++.h>   using namespace std;   long long modpow(long long a, long long b,                    long long mod = (long long)(1e9 + 7)) {     if (!b) return 1;     a %= mod;     return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;   }   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const int DEBUG = 1;   const int mxn = 2e5 + 7;   int n, k;   int dsu[mxn], sz[mxn], mini[mxn], maxi[mxn];   bool ac[mxn];   string ans;   int a[mxn], b[mxn];   void init() {     for (int i = 0; i < mxn; i++)       ac[i] = 0, dsu[i] = i, sz[i] = 1, mini[i] = i, maxi[i] = i;   }   int root(int i) { return dsu[i] = dsu[i] == i ? i : root(dsu[i]); }   void merge(int i, int j) {     if (!(0 <= i && i <= n - 1) || !(0 <= j && j <= n - 1)) return;     i = root(i);     j = root(j);     if (i == j) return;     if (sz[i] < sz[j]) swap(i, j);     dsu[j] = i;     sz[i] += sz[j];     (mini[i]) = min((mini[i]), (mini[j]));     (maxi[i]) = max((maxi[i]), (maxi[j]));   }   void activate(int i) {     ac[i] = 1;     if (i && ac[i - 1]) merge(i, i - 1);     if ((0 <= i + 1 && i + 1 <= n - 1) && ac[i + 1]) merge(i, i + 1);   }   void solve() {     scanf( %d , &n);     scanf( %d , &k);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     init();     ans = string(n,    );     for (int i = 0; i < n; i++) b[--a[i]] = i;     int t = 0;     for (int i = n - 1; i >= 0; i--)       if (!ac[b[i]]) {         activate(b[i]);         ans[b[i]] =  1  + t;         int cnt = k, j = b[i];         while (cnt-- && j < n) {           if (ac[j]) j = maxi[root(j)] + 1;           if (j >= n) break;           activate(j);           ans[j++] =  1  + t;         }         cnt = k;         j = b[i];         while (cnt-- && j >= 0) {           if (ac[j]) j = mini[root(j)] - 1;           if (j < 0) break;           activate(j);           ans[j--] =  1  + t;         }         t ^= 1;       }     cout << ans << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     solve();     return 0;   }   