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"
#define fs first
#define sc second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
ll dis,L,R=1e18;
pi pos(int u)
{
return {L+dis*(u-1),min(R,L+(dis*u)-1)};
}
long long findGap(int T, int N)
{
ll s=0,t=1e18,mn,mx;
MinMax(s,t,&L,&R);
dis=(R-L+1)/(N-1);
ll st=-1,cnt=0,res=0;
while(st==-1)
{
cnt++;
pi val=pos(cnt);
MinMax(val.fs,val.sc,&mn,&st);
}
for(int i=cnt+1;;i++)
{
pi val=pos(i);
MinMax(val.fs,val.sc,&mn,&mx);
if(val.fs==-1) continue;
res=max(res,mn-st);
st=mx;
if(mx==R) break;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |