Submission #712708

#TimeUsernameProblemLanguageResultExecution timeMemory
712708hoainiemGap (APIO16_gap)C++14
30 / 100
46 ms1952 KiB
#include "gap.h"
#include <bits/stdc++.h>
#define nmax 100008
const long long inf = 1e18;
using namespace std;
long long findGap(int T, int n)
{
    long long ans = -1, a[nmax];
    a[0] = -1;
    a[n + 1] = inf;
    a[n + 1] += 8;
    for (int i = 1, j = n; i <= j; i++, j--){
        if (i < j)
            MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[j]);
        else
            MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[n + 2]);
    }

    for (int i = 1; i < n; i++)
        ans = max(ans, a[i + 1] - a[i]);

	return ans;
}

Compilation message (stderr)

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