제출 #397936

#제출 시각아이디문제언어결과실행 시간메모리
397936dxz05Gap (APIO16_gap)C++14
0 / 100
56 ms1956 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 555555;

typedef long long ll;
ll a[MAXN];

long long findGap(int SUBTASK, int n){
    ll mn, mx;
    a[0] = 0, a[n + 1] = 1e18 + 1;
    for (int i = 1; i <= (n + 1) / 2; i++){
        MinMax(a[i - 1] + 1, a[n - i + 2] - 1, &mn, &mx);
        a[i] = mn;
        a[n - i + 1] = mx;
    }

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

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...