제출 #48378

#제출 시각아이디문제언어결과실행 시간메모리
48378BTheroGap (APIO16_gap)C++17
30 / 100
61 ms2264 KiB
#include <bits/stdc++.h>
#include "gap.h"

#define pb push_back
#define all(x) (x).begin(), (x).end()

typedef long long ll;

using namespace std;

long long findGap(int T, int N) {
    ll arr[N + 5];
    int l = 1, r = N;

    arr[0] = 0, arr[N + 1] = (ll)1e18 + 1;

    while (l <= r) {
        MinMax(arr[l - 1] + 1, arr[r + 1] - 1, arr + l, arr + r);
        ++l, --r;
    }

    ll ret = 0;

    for (int i = 2; i <= N; ++i) {
        ret = max(ret, arr[i] - arr[i - 1]);
    }

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