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;
long long int typedef li;
vector<int> find_subset(int l, int u, vector<int> w)
{
int n=w.size();
vector<int> ans;
li tsum=0;
vector<pair<int,int>> pom;
for (int i=0;i<n;i++) pom.push_back({w[i],i});
sort(pom.begin(),pom.end());
int p=0,q=-1;
while (true)
{
if (q==n-1) break;
tsum+=pom[++q].first;
while (tsum>u) tsum-=pom[p++].first;
if (l<=tsum && tsum<=u)
{
for (int i=p;i<=q;i++) ans.push_back(pom[i].second);
break;
}
}
sort(ans.begin(),ans.end());
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... |