func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 300 * 1000 + 10;   pair<int, int> c[MAX_N];   int t[MAX_N];   int main() {     ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> c[i].first, c[i].second = i;     set<int> s;     for (int i = k; i < n + k; i++) s.insert(i);     sort(c, c + n);     long long ans = 0;     for (int i = n - 1; ~i; i--) {       int id = c[i].second;       s.erase(t[id] = *s.lower_bound(id));       ans += 1LL * abs(t[id] - id) * c[i].first;     }     cout << ans << endl;     for (int i = 0; i < n; i++) cout << t[i] + 1 <<    ;     return 0;   }   