func_code_string: #include <bits/stdc++.h>   const int MAXN = 3e5 + 5;   const int INF = 0x3f3f3f3f;   const int MOD = 1e9 + 7;   using namespace std;   struct node {     int v, p;     bool operator<(const node& n) const { return v > n.v; }   } a[MAXN];   int n, k, ans[MAXN];   bool vis[MAXN << 2];   int main() {     scanf( %d %d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i].v);       a[i].p = i;     }     long long sum = 0;     memset(vis, false, sizeof(vis));     sort(a + 1, a + 1 + n);     int p = k + 1;     for (int i = 1; i <= n; i++) {       if (a[i].p >= k + 1 && !vis[a[i].p]) {         vis[a[i].p] = true;         ans[a[i].p] = a[i].p;       } else {         for (; p < n + k && vis[p]; p++)           ;         if (p > a[i].p) sum += 1LL * (p - a[i].p) * a[i].v;         vis[p] = true;         ans[a[i].p] = p;       }     }     printf( %lld n , sum);     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     return 0;   }   