# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134056 | 2019-07-22T03:23:15 Z | junodeveloper | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 KB |
#include "molecules.h" #include<bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int i; set<pair<long long,int> > st long long sum=0; st.insert({0,0}); for(i=0;i<w.size();i++) { sum+=w[i]; auto it=st.lower_bound(sum-u); if(it!=st.end()) { if(it->first<=sum-l) { vector<int> ans; for(int j=it->second+1;j<=i;j++) ans.push_back(w[j]); return ans; } } st.insert({sum,i}); } return vector<int>(0); }