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 <utility>
#define LL long long
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int N = w.size(), k = 0;
LL sL = 0, sR = 0;
std::vector<std::pair<int,int> > W;
std::vector<int> ans;
for (int i=0; i<N; i++) {
W.push_back({w[i],i});
}
std::sort(W.begin(), W.end());
while (k < N) {
sR += W[N - 1 - k].first, sL += W[k].first;
k++;
if (sR < l || sL > u) {continue;}
else {
int left = 0;
while (sL < l) {
sL += W[left+k].first - W[left].first;
left++;
}
for (int i=left; i<left+k; i++) {
ans.push_back(W[i].second);
}
return(ans);
}
}
return(ans);
}
# | 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... |