제출 #101366

#제출 시각아이디문제언어결과실행 시간메모리
101366shafinalamGap (APIO16_gap)C++14
30 / 100
65 ms2016 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

typedef long long ll;
const int lim = 4e5+5;
#define  sf scanf
#define  pf printf

#define  inf 1e18
ll arr[lim];

ll findGap(int T, int N)
{
    ll s = 0, t = inf, mn, mx;
    int l = 1, r = N;

    while(l<=r)
    {
        MinMax(s, t, &mn, &mx);
        arr[l++] = mn;
        arr[r--] = mx;
        s = mn+1;
        t = mx-1;
    }
    ll ans = 0;
    for(int i = 2; i <= N; i++) ans = max(ans, arr[i]-arr[i-1]);
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...