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"
//#include "grader.cpp"
typedef int ll;
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<ll>ans;
ll sum=w[0],l1=1,s=-1,n=w.size();
//sort(arr.begin(),arr.end());
vector<pair<ll,ll>>arr;
for(int i=0;i<n;i++)
{
arr.push_back({w[i],i});
}
sort(arr.begin(),arr.end());
for(int i=0;i<n;i++)
{
if(i!=0)
{
sum-=arr[i-1].first;
}
if(sum>=l&&sum<=u)
{
s=i;
break;
}
while(l1<n&&sum<l)
{
sum+=arr[l1].first;
l1++;
}
if(sum>=l&&sum<=u)
{
s=i;
break;
}
}
if(s==-1)return ans;
else
{
for(int i=s;i<l1;i++)
{
if(i==n)break;
ans.push_back(arr[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... |