This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: milos
* created: 08.10.2020 16:11:14
**/
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> a) {
int n = (int) a.size();
vector<pair<int, int>> v;
for (int i = 0; i < n; i++) {
v.push_back({a[i], i});
}
sort(v.begin(), v.end());
long long sum = v[0].first;
int i = 0, j = 0;
while (i < n && j < n) {
if (sum >= l && sum <= u) {
break;
}
if (sum <= u && j < n - 1) {
if (j + 1 == n) {
break;
}
j++;
sum += v[j].first;
} else {
sum -= v[i].first;
i++;
}
}
vector<int> ans;
if (sum >= l && sum <= u) {
for (int h = i; h <= j; h++) {
ans.push_back(v[h].second);
}
}
sort(ans.begin(), ans.end());
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... |