简单0-1背包
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
typedef long long ll;
const int Len=10000;
ll dp[Len];
int v[Len],w[Len];
int main(){
int t;
cin>>t;
while(t--){
int n,W;
cin>>n>>W;
for(int i=0;i<n;i++)cin>>v[i];
for(int i=0;i<n;i++)cin>>w[i];
memset(dp,0,sizeof(dp));
for(int i=0;i<n;i++){
for(int j=W;j>=w[i];j--){
dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
}
}
cout<<dp[W]<<endl;
}
}