# include <iostream>
# include <vector>
# include <algorithm>
using namespace std;
# include "gap.h"
//# include "grader.cpp"
const long long INF=1e18;
int n;
long long findGap(int T, int _N)
{
n=_N;
long long MN,MX;
MinMax(1LL,(long long)1e18,&MN,&MX);
long long last=0,ans=0;
/*
for(int bit=1;bit<60;bit++)
{
long long mn,mx;
MinMax(last+1,last+(1LL<<bit),&mn,&mx);
if(mn!=-1)
{
last=mn;
break;
}
}
*/
last=MN;
while(true)
{
//cout<<"->"<<last<<"\n";
if(last==MX) break;
for(int bit=1;bit<=60;bit++)
{
long long mn,mx;
long long s=last+1,t=last+(1LL<<bit);
MinMax(s,t,&mn,&mx);
if(mn==-1) continue;
else
{
ans=max(ans,mn-last);
last=mx;
}
}
}
return ans;
}
/*
2 4
2 3 6 8
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |