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>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
const int nax=2e3+5;
void MinMax(long long, long long, long long*, long long*);
long long findGap(int T, int N)
{
long long lst,mx;
MinMax(0,1e18,&lst,&mx);
long long ans=1;
long long q=lst;
while(mx>lst){
cout <<lst<<" "<<ans<<" "<<mx<<endl;
//return ;
long long a,b;
MinMax(q+1,q+ans,&a,&b);
if(a==-1){
while(a==-1){
ans*=2;
MinMax(q+1,q+ans,&a,&b);
}
ans=a-lst;
q=ans+lst;
lst=b;
}else{
lst=b;
q=lst;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |