Submission #738957

#TimeUsernameProblemLanguageResultExecution timeMemory
738957Abrar_Al_SamitDetecting Molecules (IOI16_molecules)C++17
46 / 100
121 ms528 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; const int nax = 1000; int par[nax * 10 + 1]; bool dp[nax * 10 + 1]; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); dp[0] = 1; for(int i=0; i<n; ++i) { for(int j=nax*10; j-w[i]>=0; --j) { if(dp[j-w[i]] && !dp[j]) { dp[j] = 1; par[j] = i; } } } int st = -1; for(int x=l; x<=u; ++x) { if(dp[x]) { st = x; break; } } vector<int>ret; if(st==-1) return ret; while(st!=0) { ret.push_back(par[st]); st -= w[par[st]]; } return ret; }
#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...