Submission #299345

#TimeUsernameProblemLanguageResultExecution timeMemory
299345williamMBDKDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms384 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; vector<signed> find_subset(signed l, signed u, vector<signed> w) { int N = w.size(); vector<int> dp (10001,-1); dp[0] = -2; for(int i = 0; i < N; i++){ for(int j = 10000; j >= w[i]; j--){ if(dp[j-w[i]] != -1){ dp[j] = i; } } } for(int i = l; i <= u; i++){ if(dp[i] != -1){ vector<signed> res; int idx = i; while(1){ res.push_back(dp[idx]); idx -= w[dp[idx]]; if(idx == 0) break; } return res; } } return {}; }
#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...