Submission #890224

#TimeUsernameProblemLanguageResultExecution timeMemory
890224MercubytheFirstDetecting Molecules (IOI16_molecules)C++17
31 / 100
1054 ms604 KiB
#include "molecules.h" #include<algorithm> #include<assert.h> #include<numeric> #include<iostream> using namespace std; using ll = long long; vector<int> find_subset(int weight_low, int weight_hi, vector<int> w) { int n = w.size(); vector<pair<int, int> > v(n); for(int i = 0; i < n; ++i) v[i] = {w[i], i}; sort(v.begin(), v.end()); for(int l = 0; l < n; ++l){ for(int r = l; r < n; ++r){ ll sum = 0; for(int i = l; i <= r; ++i) sum += v[i].first; if(weight_low <= sum and sum <= weight_hi){ vector<int> ans; for(int i = l; i <= r; ++i) ans.push_back(v[i].second); return ans; } } } return vector<int>(); }
#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...