func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     long long n;     cin >> n;     long long a[n];     long long maxi = LONG_LONG_MIN, mini = LONG_LONG_MAX;     map<long long, stack<long long> > ma;     for (long long i = 0; i < n; i++) {       cin >> a[i];       if (i < 5) {         maxi = max(maxi, a[i]);         mini = min(mini, a[i]);       }       ma[a[i]].push(i);     }     sort(a, a + n);     long long dp[n];     long long parent[n];     dp[0] = a[0];     dp[1] = a[1] - a[0];     dp[2] = a[2] - a[0];     dp[3] = a[3] - a[0];     dp[4] = a[4] - a[0];     long long ctr = 2;     memset(parent, -1, sizeof(parent));     for (long long i = 5; i < n; i++) {       long long temp1, temp2, temp3;       if (i >= 7) {         temp1 = dp[i - 3] + a[i] - a[i - 2];         temp2 = dp[i - 4] + a[i] - a[i - 3];         temp3 = dp[i - 5] + a[i] - a[i - 4];       } else if (i == 6) {         temp1 = dp[i - 3] + a[i] - a[i - 2];         temp2 = dp[i - 4] + a[i] - a[i - 3];         temp3 = LONG_LONG_MAX;       } else if (i == 5) {         temp1 = dp[i - 3] + a[i] - a[i - 2];         temp2 = LONG_LONG_MAX;         temp3 = LONG_LONG_MAX;       }       if ((temp1 <= temp2) && (temp1 <= temp3)) {         parent[i] = i - 3;       } else if ((temp2 <= temp3) && (temp2 <= temp1)) {         parent[i] = i - 4;       } else {         parent[i] = i - 5;       }       dp[i] = min(temp1, min(temp2, temp3));     }     vector<long long> res;     long long x = n - 1;     while (parent[x] != -1) {       res.push_back(x);       x = parent[x];     }     res.push_back(x);     long long ans[n];     long long team[n];     ctr = 1;     long long j = 0;     reverse(res.begin(), res.end());     for (long long i = 0; i < n; i++) {       team[i] = ctr;       if (i == res[j]) {         j++;         ctr++;       }     }     for (long long i = 0; i < n; i++) {       ans[ma[a[i]].top()] = team[i];       ma[a[i]].pop();     }     cout << dp[n - 1] <<     << ctr - 1 <<   n ;     for (long long i = 0; i < n; i++) {       cout << ans[i] <<    ;     }   }   