# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103912 | 2019-04-03T08:58:26 Z | Hideo | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 KB |
//#include "molecules.h" #include <bits/stdc++.h> #include "grader.cpp" using namespace std; #define ll long long #define pb push_back #define mk make_pair #define fr first #define sc second #define vi vector < int > #define pi pair < int, int > int n, lf; ll s; std::vector<int> find_subset(int l, int u, std::vector <int> w) { vi ans; n = w.size(); sort(w.begin(), w.end()); for (int i = 0; i < n; i++){ s += w[i]; if (s > u){ s -= w[lf]; lf++; } if (s >= l && s <= u){ for (int j = lf; j <= i; j++) ans.pb(w[j]); break; } } if (s > u) while(true); return ans; }