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<algorithm>
#include<array>
#include<iostream>
using namespace std;
vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<array<int, 2>> A((int)w.size());
for (int i = 0; i < (int)w.size(); i++) {
A[i][0] = w[i];
A[i][1] = i;
}
sort(A.begin(), A.end());
vector<int> result;
int64_t sum = 0;
int L = -1, R = 0;
while (R < (int)A.size()) {
sum += A[R][0];
while (sum > u) {
sum -= A[++L][0];
}
if (sum >= l) {
for (int i = L + 1; i <= R; i++) {
result.push_back(A[i][1]);
}
cerr << sum << '\n';
break;
}
R++;
}
return result;
}
# | 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... |