func_code_string: #include <bits/stdc++.h>   using namespace std;   struct art {     int t, d, p, id;   } a[101];   pair<int, int> go[101][2001];   bool cmp(art xx, art yy) { return xx.d < yy.d; }   int f[101][2001], num[101][2001], ans[1000], tt;   int main() {     int n;     cin >> n;     for (register int i = 1; i <= n; i++)       cin >> a[i].t >> a[i].d >> a[i].p, a[i].id = i;     sort(a + 1, a + n + 1, cmp);     for (register int i = 1; i <= n; i++)       for (register int k = 1; k <= 2000; k++) {         if (k <= a[i].d && k - a[i].t > 0) {           f[i][k] = f[i - 1][k - a[i].t] + a[i].p,           go[i][k] = make_pair(i - 1, k - a[i].t), num[i][k] = i;         }         if (f[i][k - 1] > f[i][k]) {           f[i][k] = f[i][k - 1];           go[i][k] = make_pair(i, k - 1), num[i][k] = -1;         }         if (f[i - 1][k] > f[i][k]) {           f[i][k] = f[i - 1][k];           go[i][k] = make_pair(i - 1, k), num[i][k] = -1;           ;         }       }     cout << f[n][2000] << endl;     int n1 = n, n2 = 2000;     while (go[n1][n2].first) {       if (num[n1][n2] != -1) ans[++tt] = a[num[n1][n2]].id;       pair<int, int> cur = go[n1][n2];       n1 = cur.first;       n2 = cur.second;     }     if (num[n1][n2] != -1 && num[n1][n2] != 0) ans[++tt] = a[num[n1][n2]].id;     cout << tt << endl;     for (register int i = tt; i; i--) cout << ans[i] <<    ;     cout << endl;     return 0;   }   