记录一下我并没有死..
虽然每天吃鸡的我
跟死了也差不多
这个01背包感觉有问题啊.
不是很懂他这个排序的道理
/* xzppp */
#include <iostream>
#include <vector>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define FFF freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define MP make_pair
#define PB push_back
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int > pii;
typedef pair<LL,LL> pll;
typedef pair<double,double > pdd;
typedef pair<double,int > pdi;
const int MAXN = 1e2+17;
const int MAXM = 2e3+17;
const int MAXV = 2*1e3+17;
const int BIT = 15+3;
const int INF = 0x7fffffff;
const LL INFF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 998244353;
struct dap
{
int t,d,p,id;
dap(int a,int b,int c,int d):t(a),d(b),p(c),id(d){}
dap(){}
bool operator<(const dap & b) const
{
return d<b.d;
}
}all[MAXN];
int dp[MAXM];
vector<int > ans[MAXM];
int main()
{
#ifndef ONLINE_JUDGE
FFF
#endif
int n;
cin>>n;
//cout<<"??"<<endl;
for (int i = 0; i < n; ++i)
{
int a,b,c;
cin>>a>>b>>c;
all[i] = dap(a,b,c,i);
}
sort(all, all+n);
for (int i = 0; i < n; ++i)
{
int t = all[i].t,d = all[i].d,p = all[i].p,id = all[i].id;
//cout<<id<<endl;
for (int j = MAXM; j > 0; --j)
{
if(j>=d) continue;
if(j>=t)
{
if(dp[j-t]+p>=dp[j])
{
dp[j] = dp[j-t]+p;
ans[j] = ans[j-t];
ans[j].push_back(id+1);
}
}
}
}
cout<<*max_element(dp, dp+MAXM)<<endl;
int pos = max_element(dp, dp+MAXM)-dp;
cout<<ans[pos].size()<<endl;
for (int i = 0; i < ans[pos].size(); ++i)
{
cout<<ans[pos][i]<<endl;
}
return 0;
}