# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042764 | Zicrus | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 432 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> w) {
ll n = w.size();
vector<pair<ll, ll>> s(n);
for (int i = 0; i < n; i++) {
s[i] = {w[i], i};
}
sort(s.begin(), s.end());
ll tot = 0;
vector<int> res;
for (auto &e : s) {
if (tot + e.first <= u) {
tot += e.first;
res.push_back(e.second);
}
else break;
}
ll id = n-1;
ll resId = 0;
while (tot < l && id >= res.size()) {
tot += s[id].first - s[resId].first;
res[resId] = s[id].second;
id--; resId++;
}
return tot < l ? vector<int>() : res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |