01背包但是WA两个点
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=10000;
int n,m;
pair<int,int> a[maxn];
int dp[maxn];
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i].first>>a[i].second;
}
for(int i=1;i<=n;i++){
for(int j=m;j>=a[i].first;j--){
dp[j]=max(dp[j],dp[j-a[i].first]+a[i].second);
}
}
cout<<dp[m];
return 0;
}