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 "gap.h"
#define MAXN 600007
using namespace std;
const long long inf=1e18;
long long *l,*r,*ll,*rr;
long long d,ans;
long long findGap(int T, int N){
l=new long long();
r=new long long();
MinMax(1, inf, l,r);
if(N==2)return *r-*l;
if(N<=100)return 1/0;
d=ans=1;
while(*l!=*r){
while(true){
ll=new long long();
rr=new long long();
MinMax((*l)+1,(*l)+d+1,ll,rr);
if((*ll)!=-1)break;
d*=2;
}
ans=max(ans,*ll-*l);
d=ans;
l=rr;
}
return ans;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:21:20: warning: division by zero [-Wdiv-by-zero]
21 | if(N<=100)return 1/0;
| ~^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |