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;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> ans;
int n = (int)w.size();
vector<pair<int, int>> a;
for (int i = 0; i < n; i++) {
a.emplace_back(w[i], i);
}
sort(a.begin(), a.end());
int i, j;
i = j = 0;
long long sum = 0;
while (i < n && j < n) {
sum += a[j].first;
while (sum > u) {
sum -= a[i].first;
i += 1;
}
if (l <= sum && sum <= u) {
for (int i_ = i; i_ <= j; i_++) {
ans.push_back(a[i_].second);
}
break;
}
j += 1;
}
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... |