# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
505140 | sliviu | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 332 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;
vector<int> find_subset(int l, int r, vector<int> v) {
int n = v.size();
long long s = 0;
vector<int> p(n), ans;
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&](int i, int j) {return v[i] < v[j]; });
for (int i = 0, j = -1; i < n; ++i) {
while (j + 1 < n && s < l)
s += v[p[++j]];
if (l <= s && s <= r) {
for (int k = i; k <= j; ++k)
ans.emplace_back(p[k]);
return ans;
}
if (i <= j)
s -= v[p[i]];
}
}
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... |