#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=1e9+7; int main(){ int N,M,W; cin>>N>>M>>W; vector A(N),B(N),C(M),D(M); for(int i=0;i>A[i]; } for(int i=0;i>B[i]; } for(int i=0;i>C[i]; } for(int i=0;i>D[i]; } vector> Weight((1<(1<>i)&1){ sumw+=A[i]; } } for(int i=0;i>i)&1){ sumw-=C[i]; } } Weight[Sn][Sm]=sumw; } } vector> dp((1<(1<W) continue; /* ll sumv=0; for(int i=0;i>i)&1){ sumv+=B[i]; } } for(int i=0;i>i)&1){ sumv-=D[i]; } } */ for(int i=0;i>i)&1) ==0 && 0<=(Weight[Sn][Sm] + A[i]) && (Weight[Sn][Sm] + A[i])<=W ){ dp[Sn|(1<>j&1)) ==0 && 0<=(Weight[Sn][Sm] - C[j]) && (Weight[Sn][Sm] - C[j])<=W ){ dp[Sn][Sm|(1<>i)&1)==0 && ((Sm>>j)&1)==0 ){ if( 0<=(Weight[Sn][Sm] + A[i]-C[j]) && (Weight[Sn][Sm] + A[i]-C[j])<=W ){ dp[Sn|(1<