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 "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll>num;
void nu(ll l, ll r){
ll mn,mx;
MinMax(l,r,&mn,&mx);
if(mn==-1)return;
else if(mn==mx){
num.push_back(mn);
return;
}
else{
num.push_back(mn);
num.push_back(mx);
ll mid=(mn+mx)/2;
nu(mn+1, mid);
nu(mid+1, mx-1);
return;
}
}
long long findGap(int T, int N)
{
ll l=1, r=LLONG_MAX,z=0;
nu(l,r);
sort(num.begin(),num.end());
for(int i=1; i<N; i++){
z=max(z,num[i]-num[i-1]);
}
return z;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |