Submission #380123

#TimeUsernameProblemLanguageResultExecution timeMemory
380123vishesh312Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms364 KiB
#include"molecules.h" #include"bits/stdc++.h" using namespace std; using ll = long long; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<ll, int>> v; for (int i = 0; i < (int)w.size(); ++i) { v.push_back({w[i], i}); } deque<int> dq; sort(v.begin(), v.end()); ll sum = 0; int i = 0; while (sum < l) { sum += v[i].first; dq.push_back(v[i].first); ++i; } int end = i; i = 0; while (sum > u) { sum -= dq.front(); dq.pop_front(); ++i; } vector<int> ret; for (; i < end; ++i) { ret.push_back(v[i].second); } sort(ret.begin(), ret.end()); return ret; }
#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...