Submission #445496

#TimeUsernameProblemLanguageResultExecution timeMemory
445496PiejanVDCDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms292 KiB
#include <molecules.h>
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
    int dp[u+1];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    vector<int>ans;
    bool found=false;
    for(auto z : w) {
        if(z > u) continue;
        for(int i = u ; i >= z ; i--) {
            if(dp[i-z]) {
                dp[i]=z;
                if(i >= l) {
                    int pos = i;
                    while(pos>0) {
                        ans.push_back(dp[pos]);
                        pos-=dp[pos];
                        found=true;
                    }
                    break;
                }
            }
        }
        if(found) break;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...