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 <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#define ll long long int
#define pb push_back
#define sz size()
#define N 100001
#define ff first
#define ss second
using namespace std;
ll l1, r1, md, jogi, jogj, p[N], x = 0;
map <int,int> m;
vector <int> out;
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.sz;
sort(w.begin(), w.end());
for(int i = 0; i < n; i++){
m[w[i]] = i;
p[i] = p[i-1] + w[i];
}
for(int i = 0; i < n; i++){
l1 = i+1, r1 = n-1, md = 0, jogi = -1, jogj = -1;
while(l1 <= r1){
md = (l1+r1)/2;
if(p[md] - p[i] >= l and p[md] - p[i] <= u){
jogi = i+1;
jogj = md;
break;
}
else if(p[md] - p[i] < l){
l1 = md+1;
}
else if(p[md] - p[i] > u){
r1 = md-1;
}
}
if(jogi != -1) break;
}
if(jogi == -1){
return out;
}
else{
for(int i = jogi; i <= jogj; i++){
out.pb(m[w[i]]);
}
sort(out.begin(), out.end());
return out;
}
}
| # | 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... |