Submission #218170

#TimeUsernameProblemLanguageResultExecution timeMemory
218170SamAndGap (APIO16_gap)C++17
30 / 100
62 ms2040 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

int n;
long long a[N];

long long findGap(int T, int N)
{
    n = N;
    a[0] = -1;
    a[n + 1] = 1000000000000000001;
    for (int l = 1, r = n; l <= r; ++l, --r)
    {
        long long minu, maxu;
        MinMax(a[l - 1] + 1, a[r + 1] - 1, &minu, &maxu);
        a[l] = minu;
        a[r] = maxu;
    }
    long long ans = 0;
    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:22:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 1; i < n; ++i)
     ^~~
gap.cpp:24:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  return ans;
  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...