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 <bits/stdc++.h>
#include "molecules.h"
#define endline "\n"
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define lsb(i) i&(-i)
#define sz(i) (int)i.size()
typedef long long ll;
using namespace std;
const ll INF = 1e18L;
constexpr int mod = int(1e9) + 7;
ll t=1, n, m, k, q, s, cases = 0, timee = 0;
vector<int> find_subset(int l, int u, vector<int> ar){
n = sz(ar);
vector<pair<int,int>> bruhar;
for(int i = 0; i < n; i++){
bruhar.pb(mp(ar[i],i + 1));
}
sort(bruhar.begin(),bruhar.end());
vector<int> ans;
ll sum = bruhar[0].st, i = 0, j = 0;
for(;i < n or j < n;){
if(sum >= l and sum <= u){
for(int k = i; k <= j; k++)ans.pb(bruhar[k].nd);
return ans;
}
else if(i >= n){
j++;sum += bruhar[j].st;
}
else if(j >= n){
sum -= bruhar[i].st;
i++;
}
else if(sum < l){
j++;
sum += bruhar[j].st;
}
else if(sum > u){
sum -= bruhar[i].st;
i++;
}
}
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... |