# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992112 | PedroBigMan | Training (IOI07_training) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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)];}