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;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>find_subset(int l, int u, vector<int>w) {
vector<pair<ll,int>>T;
int n=w.size();
rep(i, n) T.pb({w[i], i});
ll a=l, b=u;
sort(all(T));
ll k=0, sum=0;
vector<int>ans;
rep(i, n) {
sum+=T[i].st;
while(sum>b) {
sum-=T[k].st;
++k;
}
if(a<=sum && sum<=b) {
for(int j=k; j<=i; ++j) {
ans.pb(T[j].nd);
}
sort(all(ans));
return ans;
}
}
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... |