#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define INF 1000000019
#define POT (1<<20)
#define INFL 1000000000000000099LL
ll findGap(int T,int n){
ll pocz,kon;
MinMax(0,1000000000000000000,&pocz,&kon);
ll bst=(kon-pocz+n-2)/(n-1);
while(pocz!=kon){
ll a,b;
//cout<<bst<<" ";
MinMax(pocz+1,pocz+bst,&a,&b);
if(b!=-1){
pocz=b;
}
else{
MinMax(pocz+bst+1,pocz+2*bst,&a,&b);
while(b==-1){
bst*=2;
MinMax(pocz+bst+1,pocz+bst*2,&a,&b);
}
//cout<<pocz<<" "<<a<<"x\n";
bst=a-pocz;
pocz=b;
}
}
return bst;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |