Submission #423600

#TimeUsernameProblemLanguageResultExecution timeMemory
423600vanicDetecting Molecules (IOI16_molecules)C++14
46 / 100
131 ms552 KiB
#include "molecules.h" #include <vector> #include <cmath> #include <algorithm> #include <cstring> using namespace std; const int maxn=1e4+5; int dp[maxn]; int pos[maxn]; vector < int > sol; void rijesi(int x){ if(!x){ return; } sol.push_back(pos[x]); rijesi(dp[x]); } void dodaj(int x, int poz){ for(int i=maxn-1; i>=x; i--){ if(dp[i]==-1 && dp[i-x]!=-1){ dp[i]=i-x; pos[i]=poz; } } } vector < int > find_subset(int l, int u, vector < int > w) { memset(dp, -1, sizeof(dp)); dp[0]=0; int n=w.size(); for(int i=0; i<n; i++){ dodaj(w[i], i); } for(int i=l; i<=u; i++){ if(dp[i]!=-1){ rijesi(i); return sol; } } return sol; }
#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...