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>
#ifdef GUDEB
#define D(x) cerr << #x << ": " << (x) << '\n';
#define ifdeb if(true)
#else
#define D(x) ;
#define ifdeb if(false)
#endif
#define all(x) begin(x), end(x)
using namespace std;
using ull = unsigned long long;
using ll = long long;
// #define int ll;
vector<int> find_subset(int l, int u, vector<int> ws) {
sort(all(ws));
int n = ws.size();
int s = 0;
int be = 0;
int eb = n;
while(s < l) {
s += ws[be];
++be;
}
while(true) {
if(s > u) {
if(be == 0) return {};
--be;
s -= ws[be];
} else if(s < l) {
if(eb == be) return {};
--eb;
s += ws[eb];
} else {
vector<int> res;
for(int i = 0; i < be; ++i) res.push_back(ws[i]);
for(int i = eb; i < n; ++i) res.push_back(ws[i]);
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... |