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;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
int n = w.size();
sort(w.begin(),w.end());
vector<int> result;
while(n != 0 && w[n-1] < l)
{
result.push_back(n-1);
l -= w[n-1];u -= w[n-1];
n--;
}
if(n == 0)return {};
result.push_back(n-1);
if(w[n-1] <= u)return result;
for(int i = 0;i < n-1;i++)
{
if(w[i] + w[n-1] >= l + w[w.size()-1] && w[i] + w[n-1] <= u + w[w.size()-1])
{
result[0] = i;
return result;
}
}
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... |