Submission #739406

#TimeUsernameProblemLanguageResultExecution timeMemory
739406Abrar_Al_SamitDetecting Molecules (IOI16_molecules)C++17
31 / 100
1072 ms716 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; const int nax = 1000; bitset<nax * 500 + 1>dp; bool taken[nax]; 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) { dp |= (dp<<w[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) { for(int i=0; i<n; ++i) if(!taken[i] && st-w[i]>=0 && dp[st-w[i]]) { taken[i] = true; ret.push_back(i); st -= w[i]; } } 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...