Submission #773896

#TimeUsernameProblemLanguageResultExecution timeMemory
773896AminjinGap (APIO16_gap)C++14
0 / 100
40 ms1924 KiB
#include "gap.h" #include<iostream> #include <climits> using namespace std; long long findGap(int T, int N) { long long mn, mx, i, j; long long a[N+1]; MinMax(0LL,LLONG_MAX, &mn, &mx); a[1] = mn; a[N] = mx; i = 1; j = N; while ( mn != -1 && mx != -1 && mx > mn+1 ) { long long d, b; MinMax(mn+1, mx-1, &d, &b); mn = d, mx = b; i ++; j --; if ( mn == -1 ) break; a[i] = mn; a[j] = mx; } long long diff = 0; for ( i = 1; i < N; i ++ ) { // cout << a[i] << " "x; diff = max(diff, a[i+1] - a[i]); } // cout << a[N] << endl; return diff; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...