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"
using namespace std;
const long long MAX_A = 1e18;
long long findGap(int T, int N){
long long lst = 0, mx_dist = 1;
for(long long mn ,mx ,d=1; ; d<<=1){
MinMax(0 ,d ,&mn ,&mx);
if(mn != -1){
lst = mn;
break;
}
}
for(int ok=1; ok; )
{
for(long long mn,mx ,nxt=mx_dist; ok; nxt<<=1){
MinMax(lst+1 ,min(MAX_A ,lst+nxt) ,&mn ,&mx);
if(lst+nxt >= MAX_A)
ok = 0;
if(mn != -1){
mx_dist = max(mx_dist ,mn-lst);
lst = mx;
break;
}
}
}
return mx_dist;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |