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 f first
#define s second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
ll mas=0LL;
ll vv[100001];
int k=0;
int N;
void ric(ll a,ll b){
ll u,v;
MinMax(a,b,&u,&v);
if(u==-1&&v==-1)return;
if(u==v){vv[k++]=u;
return;}
ll pivot=(v-u)/(N-k);
int ini=u;
for(int i=0;i<N-k-1;i++){
pivot=max(1LL,(v-ini)/(N-k));
ric(ini,ini+max(0LL,pivot-1));
ini+=pivot;
}
if(ini<v)ric(ini,v);
}
int findGap(int T,int N){
::N=N;
if(T==2){
ric(0LL,1000000000000000000LL);
for(int i=0;i<N-1;i++)mas=max(mas,vv[i+1]-vv[i]);
return mas;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |