# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992112 | 2024-06-04T00:10:38 Z | PedroBigMan | Training (IOI07_training) | C++14 | 0 ms | 0 KB |
vector<ll> thisdp(1<<S,0); REP(i,0,P) { A = costs[i].ff.ff; B = costs[i].ff.ss; C = costs[i].ss; ll valA = 0; if(A>=0) {valA=(1<<A);} ll valB = 0; if(B>=0) {valB=(1<<B);} ll rec = valA+valB; for(ll j = (1<<S) -1; j>=0; j--) { if(A>=0 && (j&valA)==0) {continue;} if(B>=0 && (j&valB)==0) {continue;} thisdp[j]=max(thisdp[j],thisdp[j-rec]+C); } } dp[s][S] = thisdp[(1<<S) -1]; REP(i,0,S) {dp[s][i]=thisdp[(1<<S)-1-(1<<i)];}