제출 #35034

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

const int N = 1e5 + 5;
long long a[N];

long long findGap(int T, int n) {
	assert(T == 1);
	long long s = 0, t = 1e18;
	long long mn, mx;

	for (int i = 1; i <= (n + 1) / 2; ++i) {
		if (s <= t) MinMax(s, t, &mn, &mx);
		a[i] = mn; a[n - i + 1] = mx;
		s = mn + 1, t = mx - 1;
	}

	long long 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...