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;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
//#define int ll
const ll mod=1e9+7;
vector<int> find_subset(int l,int u,vector<int> w){
int n = (int) w.size();
vector< pair<int,int> > v(n);
for(int i=0;i<n;i++){
v[i].first = w[i];
v[i].second = i;
}
sort(all(v));
int j=0,sum=0;
for(int i=0;i<n;i++){
sum+=v[i].first;
while(sum > u && j < i){
sum-=v[j].first;
j++;
}
if(l <= sum && sum <= u){
vector<int> ans;
for(int o=j;o<=i;o++) ans.pb(v[o].second);
return ans;
}
}
return {};
}
# | 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... |