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> ans;
int i, j, n, sum;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
sort(w.begin(), w.end());
n = w.size();
i = 0;
j = 0;
sum = w[0];
while (j < n) {
if (l <= sum && sum <= u) {
break;
}
else if (sum < l) {
if (j+1 == n) {
break;
}
sum += w[++j];
}
else {
sum -= w[i++];
}
}
if (l <= sum && sum <= u) {
for (int x=i; x <= j; x++) {
ans.push_back(x);
}
}
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... |