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 <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "gap.h"
#define ll long long
#define MAXV 1e18
using namespace std;
long long solve1(int n)
{
return 2;
}
long long findGap(int T, int N)
{
if(T == 1)
return solve1(N);
long long a,b;
MinMax(0LL,MAXV,&a,&b);
ll dif = (b-a)/(N-1)-2;
ll k = 1;
while(a < b)
{
ll w,x;
//cout << a << " " << b << " " << call_count << " " << dif << endl;
MinMax(a+1,a+dif*k,&x,&w);
if(w == -1)
{
k++;
continue;
}
if(k != 1)
dif = max(dif,x-a);
a = w;
}
return dif;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |