Submission #443154

#TimeUsernameProblemLanguageResultExecution timeMemory
443154hossain2020Gap (APIO16_gap)C++14
30 / 100
53 ms1868 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long v[1000005],i,j; long long findGap(int T, int N) { j=0; i=N-1; long long c=0,d=1e18; long long *a=&c,*b=&d; while (i>j) { MinMax(c,d,a,b); if (*a+*b==-2)break ; v[j]=*a; v[i]=*b; i--; j++; c=*a; c++; *a=c; d=*b; d--; *b=d; } if (N%2==1) { d++; *b=d; MinMax(c,d,a,b); v[i]=*a; } long long o=0; for (int i=1;i<N;i++) { o=max(o,v[i]-v[i-1]); } return o; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...