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;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int, int>> ww;
int sz = w.size();
for(int i=0;i<sz;i++)
ww.push_back({w[i], i});
sort(ww.begin(), ww.end());
int a = 0, b = 0, csum = ww[0].first;
int can = -1;
while(b < sz)
{
if(csum >= l && csum <= u)
{
can = 1;
break;
}
if(csum < l)
{
b++;
if(b == sz)
break;
csum += ww[b].first;
}
else if(csum > u)
{
csum -= ww[a].first;
a++;
}
}
vector<int> ans;
if(can == -1)
return ans;
for(int i=a;i<=b;i++)
ans.push_back(ww[i].second);
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... |