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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
vector<int> s(n);
for(int i = 0; i < n; i++) s[i] = i;
sort(s.begin(), s.end(), [&](int a, int b){
return w[a] < w[b];
});
ll sum = 0;
vector<int> ans;
int i = 0, j = 1;
sum = w[s[0]];
for(;j < n; j++){
sum+=w[s[j]];
while(sum > u) sum-=w[s[i]], i++;
if(sum >= l && sum <= u) break;
}
if(sum < l || sum > u) return ans;
for(int k = i; k <= j; k++) ans.pb(s[k]);
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... |