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 r, vector<int> w) {
vector<array<int, 2>> a;
int n = w.size();
for (int i = 0; i < n; ++i) {
a.push_back({w[i], i});
}
sort(a.begin(), a.end());
int L = 0, R = 0, sum = a[0][0];
while (R < n) {
if (sum > r) {
sum -= a[L][0];
++L;
}
else if (sum < l) {
++R;
sum += a[R][0];
}
else {
vector<int> ans;
for (int i = L; i <= R; ++i) {
ans.push_back(a[i][1]);
}
return ans;
}
}
return {};
}
# | 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... |