Submission #491993

#TimeUsernameProblemLanguageResultExecution timeMemory
491993eNGyDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> using namespace std; int N; vector<int> sol; bool dfs(int n, int s, int l, int u, vector<int> &w, bool v[]){ v[n] = 1; sol.push_back(n); if(s > u){ return false; }else if(s >= l){ return true; } for(int i=0; i<N; i++){ if(!v[i]){ if(dfs(i, s + w[i], l, u, w, v)){ return true; } } } v[n] = 0; sol.pop_back(); return false; } vector<int> find_subset(int l, int u, vector<int> w){ N = w.size(); int i = 0; bool v[N]; fill(v, v+N, 0); while(i < N && !dfs(i, w[i], l, u, w, v)){ i++; } 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...