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) {
int n = w.size();
vector<pair<int, int>> v;
for (int i = 0; i < n; i++) {
v.emplace_back(w[i], i);
}
sort(v.begin(), v.end());
int s = 0, h = 0, t = 0;
while (t < n) {
while (t < n && s < l) {
s += v[t].first;
t++;
}
if (l <= s && s <= u) {
vector<int> ans;
for (int i = h; i < t; i++) ans.emplace_back(i);
return ans;
}
while (h < t && s >= l) {
s -= w[h];
h++;
}
}
return vector<int>();
}
# | 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... |