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 <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector <int> find_subset(int L, int U, vector <int> w) {
int n = w.size();
vector <pair <int, int>> weights;
for(int i = 0; i < n; i++) {
weights.emplace_back(w[i], i);
}
sort(weights.begin(), weights.end());
long long sum = 0;
int l = 0, r = -1;
while(r < n) {
if(sum < L) {
sum += weights[++r].first;
}
else if(sum > U) {
sum -= weights[l++].first;
}
else {
vector <int> ans;
for(int i = l; i < r; i++) {
ans.push_back(weights[i].second);
}
return ans;
}
}
return vector <int> ();
}
# | 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... |