// Wrongri-La Shower #include #include #include typedef std::pair P; typedef std::pair Q; int N; int V[10000], T[10000]; int dp[1<<12][20001]; int solve(){ Q ps[10000]; for(int i=0;i 20000){continue;} mx[j] = std::max(mx[j], mx[j+p.second]); } } return mx[0]; } int rec(int state, int sum){ if(dp[state][sum] != -1){return dp[state][sum];} int res = sum; for(int i=0;i> i & 1){continue;} if(sum >= T[i]){continue;} res = std::max(res, rec(state | (1 << i), sum + V[i])); } return dp[state][sum] = res; } // bitDP解 (弱) int solve1(){ for(int i=0;i<1<