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;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
sort(w.begin(), w.end());
int le = 0, ri = 0, tot = 0;
int sz = w.size();
bool flag = false;
while(tot > u || tot < l)
{
if(tot > u)
{
tot -= w[le];
le +=1;
}
else if(tot < l)
{
ri +=1;
tot +=w[ri];
}
if(le == sz || ri == sz)
{
flag = true;
break;
}
}
vector<int> ans;
if(flag)
{
return ans;
}
for(int i = le; i <=ri; i ++)
{
ans.push_back(w[i]);
}
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... |