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;
typedef long long ll;
#define ii pair<ll,ll>
vector<int> find_subset(int l, int u, vector<int> w) {
int n=(int)w.size();
vector<ii> v(n);
for(int i=0;i<n;i++)
v[i]={w[i],i};
sort(v.begin(),v.end());
int i=0,j=0;
ll sum=0;
while(sum<l || sum>u){
if(sum<l){
if(j==n) break;
sum+=v[j].first;
j++;
}
else{
if(i>j) break;
sum-=v[i].first;
i++;
}
}
if(sum<l || sum>u) return vector<int> ();
vector<int> res;
for(int k=i;k<j;k++) res.push_back(v[k].second);
return res;
}
# | 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... |