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;
const auto NO = vector<int>(0);
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int, int>> v(w.size());
for(int i=0; i<(int)w.size(); i++) v[i] = {w[i], i};
sort(v.begin(), v.end());
long long sum = 0;
int lo = 0, hi = 0;
while(hi < (int)v.size() && lo <= hi){
if(sum < l) sum += v[hi++].first;
if(sum > u) sum -= v[lo++].first;
if(sum >= l && sum <= u){
vector<int> sol;
for(int i=lo; i<hi; i++) sol.push_back(v[i].second);
return sol;
}
}
return NO;
}
# | 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... |