# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388552 | ParsaAlizadeh | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 208 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> w) {
vector<int> ind(w.size());
iota(begin(ind), end(ind), 0);
sort(begin(ind), end(ind), [&] (int i, int j) {
return w[i] < w[j];
});
long long cur = 0;
int ptr = 0;
for (int i = 0; i < w.size(); i++) {
cur += w[ind[i]];
while (ptr < i && cur > r)
cur -= w[ind[ptr++]];
if (cur >= l)
return vector<int>(begin(ind) + ptr, begin(ind) + i + 1);
}
return vector<int>(0);
}
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... |