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;
typedef long long ll;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
ll s=0;
int lo=0, hi=0, n=w.size();
vector<int> ans(0);
vector<pair<int, int>> t;
for (int i = 0; i < n; ++i) t.emplace_back(w[i], i);
sort(t.begin(), t.end());
while (lo<n) {
if (s<l) {
if (hi<n) s+=t[hi++].first;
else break;
} else if (s>u && lo<n) s-=t[lo++].first;
if (l<=s && s<=u) {
for (int i = lo; i < hi; ++i) ans.push_back(t[i].second);
break;
}
}
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... |