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 vector<int> vec;
struct node{int val,id;}a[200100];
bool cmp(node x,node y){return x.val<y.val;}
long long s[200100];
vec find_subset(int l,int u,vec w) {
int n=w.size();
for (int i=1;i<=n;i++){
a[i].val=w[i-1];a[i].id=i-1;
}
sort(a+1,a+n+1,cmp);
s[0]=0;
for (int i=1;i<=n;i++)s[i]=s[i-1]+a[i].val;
int i=1,j=1;
while(i<=j&&j<=n){
if (s[j]-s[i-1]<l)j++;
else if (s[j]-s[i-1]>u)i++;
else{
vector<int> ans;
for (int k=i;k<=j;k++)ans.push_back(a[k].id);
return ans;
}
}
vector<int> S;
return S;
}
# | 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... |