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"
std::vector<int> find_subset(int a, int b, std::vector<int> w) {
sort(w.begin(),w.end());
int n = w.size();
int resr = 0,resl = n;
int l = 0;
int ans = 0;
int sum = 0;
for(int r = 0;r < n;r++) {
sum += w[r];
if(sum < a) {
continue;
}
while(sum > b && l <= r) {
sum -= w[l];
l++;
}
if(sum >= a && sum <= b) {
if(ans < r - l + 1) {
ans = r - l + 1;
resr = r,resl = l;
}
}
}
std::vector<int> res;
for(int i = resl;i <= resr;i++) {
res.push_back(w[i]);
}
return res;
}
# | 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... |