# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582056 | Soumya1 | Detecting Molecules (IOI16_molecules) | C++17 | 61 ms | 4796 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 "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> order(w.size());
iota(order.begin(), order.end(), 0);
sort(order.begin(), order.end(), [&](int i, int j) { return w[i] < w[j]; });
long long cur = 0;
int ptr = 0;
for (int i = 0; i < w.size(); i++) {
while (cur < l && ptr < w.size()) cur += w[order[ptr]], ptr++;
if (l <= cur && cur <= u) {
vector<int> ans;
for (int j = i; j < ptr; j++) ans.push_back(order[j]);
return ans;
}
if (ptr > i) cur -= w[order[i]];
}
return {};
}
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... |