#include #include #include using namespace std; int main(){ int C,N; cin>>C>>N; vector W(N); for(auto &w:W)cin>>w; int DP[(1<>=1){ if(bb&1)co|=~B&-~B; B|=~B&-~B; } DP[comb|co]=min(DP[comb|co],DP[comb]+DP[co]); } int x=comb&-comb, y=comb+x; comb = ((comb&~y)/x>>1)|y; } } // for(int i=0;i<(1< >(i)<<' '<