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"
using ll = long long;
int const nmax = 100000;
int seen[1 + nmax];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
std::vector<int> sol;
int n = w.size();
ll sum1 = 0, sum2 = 0;
for(int i = 0; i < n; i++){
seen[i] = 1;
sum1 += w[i];
sum2 += w[n - 1 - i];
if(sum1 <= u && l <= sum2){
int ptr = 0;
while(sum1 < l){
seen[ptr] = 0;
seen[n - 1 - ptr] = 1;
sum1 -= w[ptr];
sum1 += w[n - 1 - ptr];
}
for(int i = 0; i < n; i++)
if(seen[i] == 1)
sol.push_back(i);
return sol;
}
}
return sol;
}
# | 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... |