func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   template <class T>   ostream& operator<<(ostream& os, vector<T> V) {     os <<  [  ;     for (auto v : V) os << v <<    ;     return os <<  ] ;   }   template <class L, class R>   ostream& operator<<(ostream& os, pair<L, R> P) {     return os <<  (  << P.first <<  ,  << P.second <<  ) ;   }   const long long int mod = 1e9 + 7;   const long long int maxn = 5 * 100001;   long long int power(long long int x, long long int n) {     x %= mod;     long long int res = 1;     for (; n > 0; n >>= 1) {       if (n & 1) res = (res * x) % mod;       x = (x * x) % mod;     }     return res;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n;     cin >> n;     pair<long long int, long long int> a[n];     for (long long int i = 0; i < n; i++) {       cin >> a[i].first;       a[i].second = i + 1;     }     sort(a, a + n);     long long int dp[n + 1];     dp[n] = 0;     dp[n - 1] = mod;     dp[n - 2] = mod;     dp[n - 3] = a[n - 1].first - a[n - 3].first;     long long int got[n + 5];     got[n - 3] = n;     got[n - 2] = n;     got[n - 1] = n;     for (long long int i = n - 4; i >= 0; i--) {       long long int mini = mod;       mini = min(mini, a[i + 2].first - a[i].first + dp[i + 3]);       if (i + 4 <= n) mini = min(mini, a[i + 3].first - a[i].first + dp[i + 4]);       if (i + 5 <= n) mini = min(mini, a[i + 4].first - a[i].first + dp[i + 5]);       for (long long int j = 2; j <= 4; j++) {         if (j + i + 1 <= n) {           if (mini == a[i + j].first - a[i].first + dp[i + j + 1]) {             got[i] = i + j + 1;             break;           }         }       }       dp[i] = mini;     }     long long int ans[n + 1];     long long int m = 0;     for (long long int i = 0, j = 0; i < n; i = j) {       m++;       while (j != got[i]) {         ans[a[j].second] = m;         j++;       }     }     cout << dp[0] <<     << m << endl;     for (long long int i = 1; i <= n; i++) {       cout << ans[i] <<    ;     }   }   