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 "gap.h"
#include <bits/stdc++.h>
// #include "grader.cpp"
using namespace std;
// long long solve(){
// }
long long findGap(int T, int N)
{
// if(T==1)
// return solve(N);
long long mn,mx;
long long s=0,t=1e18;
MinMax(s,t,&mn,&mx);
s=mn+1,t=mx;
long long gap=(t-s)/(N-1);
long long ans=0;
long long pre=mn;
while(s<t){
MinMax(s,min(s+gap,t),&mn,&mx);
if(mn==-1)
s+=gap;
else{
gap=max(gap,mn-pre);
s=mx+1;
pre=mx;
}
}
return gap;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:17:12: warning: unused variable 'ans' [-Wunused-variable]
17 | long long ans=0;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |