Submission #1062625

#TimeUsernameProblemLanguageResultExecution timeMemory
1062625nvujicaDetecting Molecules (IOI16_molecules)C++14
46 / 100
106 ms604 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; const int maxn = 1e4 + 10; int n; int bio[maxn]; vector<int> find_subset(int l, int u, vector<int> w) { n = w.size(); memset(bio, -1, sizeof bio); bio[0] = 0; for(int i = 0; i < n; i++){ for(int j = maxn - 1; j >= 0; j--){ if(bio[j] != -1 && j + w[i] <= u && bio[j + w[i]] == -1){ bio[j + w[i]] = i; } } } int x = 0; for(int i = l; i <= u; i++){ if(bio[i] != -1){ x = i; break; } } vector <int> v; while(x){ v.push_back(bio[x]); x -= w[bio[x]]; } reverse(v.begin(), v.end()); return v; }
#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...