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;
typedef long long ll;
typedef pair <int, int> pii;
std::vector<int> find_subset(int l, int u, std::vector<int> W) {
vector <int> ret;
int n = W.size();
vector <pii> w(n);
for(int i = 0; i < n; ++i) {
w[i] = {W[i], i};
}
sort(w.begin(), w.end());
ll sum = 0;
int left = 0, right = -1;
while (right < n-1) {
sum += w[++right].first;
while (sum > u && left <= right) {
sum -= w[left++].first;
}
if (l <= sum && sum <= u) {
break;
}
}
if (l <= sum && sum <= u) {
while (left <= right) ret.push_back(left++);
}
return ret;
}
# | 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... |