제출 #491980

#제출 시각아이디문제언어결과실행 시간메모리
491980eNGyDetecting Molecules (IOI16_molecules)C++17
0 / 100
1082 ms288 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 >= l){ return true; } for(int i=0; i<N; i++){ if(!v[i] && s + w[i] <= u){ 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] = {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...