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<iostream>
#include "gap.h"
#define l 1000000000000000000
using namespace std;
long long subt1(long long n)
{
long long tf,ts,pf,ps,mr=0;
MinMax(0,l,&tf,&ts);
for(int i=2;i<=n/2;i++)
{
pf=tf;ps=ts;
MinMax(pf+1,ps-1,&tf,&ts);
if(tf-pf>mr) mr=tf-pf;
if(ps-ts>mr) mr=ps-ts;
}
if(n%2)
{
if(tf+1<=ts-1)
MinMax(tf+1,ts-1,&pf,&ps);
if(pf-tf>mr) mr=pf-tf;
if(ts-pf>mr) mr=ts-pf;
}
else if(ts-tf>mr) mr=ts-tf;
return mr;
}
long long findGap(int T, int N)
{
return subt1(N);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |