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;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
vector<int> find_subset(int l, int r, vector<int> w) {
vector<pii> s;
for (int i = 0; i < sz(w); i++) s.push_back({w[i], i});
sort(all(s));
ll sum = 0, is = 0;
deque<int> res;
for (int i = 0; i < sz(w) && !is; i++) {
sum += s[i].f;
res.push_back(i);
if (sum > r) {
sum -= s[res.front()].f;
res.pop_front();
is = 1;
}
if (sum >= l) {
vector<int> ans;
for (int x: res) ans.push_back(s[x].s);
return ans;
}
}
return {};
}
# | 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... |