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>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define dbg(v) cerr << "\n" << #v << " = " << v << "\n"
using namespace std;
using ll = long long;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int,int>> a;
for (int i = 0; i < n; ++i) a.push_back({w[i], i});
sort(all(a));
ll le = 0, sum = 0;
vector<int> res;
for (int i = 0; i < n; ++i) {
sum += a[i].fi;
while (i-le+1 > 1 && sum > u) sum -= a[le++].fi;
if (l <= sum && sum <= u) {
for (int j = le; j <= i; ++j) res.push_back(a[j].se);
break;
}
}
return res;
}
# | 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... |