Submission #890157

#TimeUsernameProblemLanguageResultExecution timeMemory
890157MercubytheFirstDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms348 KiB
#include "molecules.h" #include<algorithm> #include<assert.h> using namespace std; using ll = long long; vector<int> find_subset(int weight_low, int weight_hi, vector<int> w) { sort(w.begin(), w.end()); ll l = 0, r = 0, sum = 0, n = w.size(); while(sum < weight_low or weight_hi < sum){ if(sum < weight_low){ if(n <= r) return vector<int>(); sum += w[r]; ++r; } else if(sum > weight_hi){ assert(l <= r); sum -= w[l]; l++; } } vector<int> ans(w.begin() + l, w.begin() + r); return ans; }
#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...