Submission #413007

#TimeUsernameProblemLanguageResultExecution timeMemory
413007jjjGap (APIO16_gap)C++14
30 / 100
52 ms1920 KiB
#include "gap.h"
#define MAXN 100010

long long a[MAXN];

long long findGap(int T, int N)
{
    long long mn = 0, mx = 0;

    MinMax(0, 1e18 + 1, &mn, &mx);

    a[0] = mn;
    a[N - 1] = mx;

    int l = 1, r = N - 2;

    while(l <= r)
    {
        MinMax(a[l - 1] + 1, a[r + 1] - 1, &mn, &mx);

        a[l] = mn;
        a[r] = mx;

        l++;
        r--;
    }

    long long x = 0;

    for(int i = 0; i < N - 1; i++)
        if(a[i + 1] - a[i] > x) x = a[i + 1] - a[i];

	return x;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |     for(int i = 0; i < N - 1; i++)
      |     ^~~
gap.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  return x;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...