# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725586 | HaroldVemeno | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 296 KiB |
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();
ll s = 0;
int be = n;
int eb = n;
for(int i = 0; i < ws.size(); ++i) s += ws[i];
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;
}
}
}
Compilation message (stderr)
# | 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... |