func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200005;   struct node {     int index, val, team;   };   node ni[N];   int divi[N], rest[N];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       ni[i].index = i;       scanf( %d , &ni[i].val);     }     sort(ni, ni + n, [](const node &a, const node &b) { return a.val < b.val; });     fill(begin(divi), end(divi), -0x3f3f3f3f);     for (int i = 3; i < n; ++i) {       divi[i] = rest[i - 3] + ni[i].val - ni[i - 1].val;       rest[i - 2] = max(divi[i - 2], rest[i - 3]);     }     int k = 1;     for (int i = n - 1; i >= n - 3; --i) {       ni[i].team = k;     }     for (int i = n - 3; i > 0;) {       if (rest[i] == divi[i]) {         ++k;         for (int j = i; j > 0 && j > i - 3; --j) {           ni[j - 1].team = k;         }         i -= 3;       } else {         i -= 1;         ni[i].team = k;       }     }     printf( %d %d n , ni[n - 1].val - ni[0].val - rest[n - 3], k);     sort(ni, ni + n,          [](const node &a, const node &b) { return a.index < b.index; });     for (int i = 0; i < n; ++i) {       printf( %d  , ni[i].team);     }     printf(  n );     return 0;   }   