#include<cstdio>
#include<algorithm>
using namespace std;
int n,V,op[20010],c[20010],w[20010],f[10010];
int main(){
	scanf("%d%d",&n,&V);
	for(int i=1;i<=n;++i){
		scanf("%d%d%d",&op[i],&c[i],&w[i]);
	}
	for(int i=1;i<=n;++i){
		if(op[i]==2){
			for(int v=V;v>=w[i];--v){
				f[v]=max(f[v],f[v-w[i]]+c[i]);
			}
		}
		else{
			for(int v=w[i];v<=V;++v){
				f[v]=max(f[v],f[v-w[i]]+c[i]);
			}
		}
	}
	printf("%d\n",f[V]);
	return 0;
}

相关文章:

  • 2021-08-25
  • 2021-07-22
  • 2022-12-23
  • 2021-05-31
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
猜你喜欢
  • 2021-06-10
  • 2021-08-24
  • 2021-05-15
  • 2022-12-23
  • 2021-10-27
  • 2022-03-02
相关资源
相似解决方案