func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1000000001;   const long double EPS = 1e-9;   const int MOD = 1000000007;   const long long LLINF = 1000000000000000001;   const int maxn = 350000;   int n, k;   int result[maxn];   int cost[maxn];   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> cost[i];     set<pair<int, int>, greater<pair<int, int> > > s;     for (int i = 1; i <= k; i++) s.insert(make_pair(cost[i], i));     for (int i = k + 1; i <= n; i++) {       s.insert(make_pair(cost[i], i));       result[s.begin()->second] = i;       s.erase(s.begin());     }     for (int i = n + 1; i <= n + k; i++) {       result[s.begin()->second] = i;       s.erase(s.begin());     }     long long sumCost = 0;     for (int i = 1; i <= n; i++) sumCost += (long long)(result[i] - i) * cost[i];     cout << sumCost <<   n ;     for (int i = 1; i <= n; i++) cout << result[i] <<    ;     cout << endl;   }   