제출 #63790

#제출 시각아이디문제언어결과실행 시간메모리
63790kingpig9Gap (APIO16_gap)C++11
30 / 100
81 ms9464 KiB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5 + 10;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))

int N;
ll A[MAXN];

ll findGap (int subtask, int nnn) {
	N = nnn;
	for (int i = 1, j = N; i <= j; i++, j--) {
		ll mn, mx;
		if (i == 1) {
			mn = 0;
			mx = 1e18;
		} else {
			mn = A[i - 1] + 1;
			mx = A[j + 1] - 1;
		}
		MinMax(mn, mx, &mn, &mx);
		A[i] = mn;
		A[j] = mx;
	}

	ll ans = 0;
	for (int i = 2; i <= N; i++) {
		ans = max(ans, A[i] - A[i - 1]);
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...