#include #include #include #include #include #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define ALL(c) (c).begin(), (c).end() #define INF 99999999 using namespace std; typedef int Weight; typedef vector Array; typedef vector Matrix; const int M = 20; Weight best[1<0) { if (w[j]>0) { Weight hp=min(best[S]+w[j],total[S]); if (best[S|(1<