func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Student {     int number;     int cost;     int com;   };   bool comp1(Student a, Student b) {     if (a.cost < b.cost) return true;     return false;   }   bool comp2(Student a, Student b) {     if (a.number < b.number) return true;     return false;   }   int main() {     long n, t, k, res, q;     cin >> n;     Student* A = new Student[n];     int* K = new int[n];     for (int i = 0; i < n; i++) {       A[i].number = i;       A[i].com = 0;       cin >> A[i].cost;     }     sort(A, A + n, comp1);     int* D = new int[n];     int* C = new int[n];     D[2] = -1;     C[2] = A[2].cost - A[0].cost;     K[2] = 1;     for (int i = 3; i < n; i++) {       D[i] = -1;       C[i] = A[i].cost - A[0].cost;       K[i] = 1;       if (i >= 5) {         if (i - 3 >= 2 && (C[i - 3] + A[i].cost - A[i - 2].cost) < C[i]) {           C[i] = C[i - 3] + A[i].cost - A[i - 2].cost;           D[i] = i - 3;           K[i] = K[i - 3] + 1;         }         if (i - 4 >= 2 && (C[i - 4] + A[i].cost - A[i - 3].cost) < C[i]) {           C[i] = C[i - 4] + A[i].cost - A[i - 3].cost;           D[i] = i - 4;           K[i] = K[i - 4] + 1;         }         if (i - 5 >= 2 && (C[i - 5] + A[i].cost - A[i - 4].cost) < C[i]) {           C[i] = C[i - 5] + A[i].cost - A[i - 4].cost;           D[i] = i - 5;           K[i] = K[i - 5] + 1;         }       }     }     q = n - 1;     while (q != -1) {       A[q].com = K[q];       t = q - 1;       while (t != D[q]) {         A[t].com = K[q];         t--;       }       q = D[q];     }     res = C[n - 1];     cout << res <<     << K[n - 1] << endl;     sort(A, A + n, comp2);     for (int i = 0; i < n; i++) cout << A[i].com <<    ;     return 0;   }   