Submission #712702

#TimeUsernameProblemLanguageResultExecution timeMemory
712702hoainiemGap (APIO16_gap)C++17
0 / 100
46 ms1960 KiB
#include "gap.h"
#include <bits/stdc++.h>
#define nmax 100008
const long long inf = 1e18 + 8;
using namespace std;
long long findGap(int T, int n)
{
    long long ans = -1, a[nmax];
    a[0] = -1;
    a[n + 1] = inf;
    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:18:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |     for (int i = 1; i < n; i++)
      |     ^~~
gap.cpp:21:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   21 |  return ans;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...