제출 #1196443

#제출 시각아이디문제언어결과실행 시간메모리
1196443The_SamuraiGap (APIO16_gap)C++20
30 / 100
30 ms1956 KiB
#include "bits/stdc++.h"
#include "gap.h"
using namespace std;
using ll = long long;

long long findGap(int t, int n) {
	vector<ll> a(n);
	int l = 0, r = n - 1;
	ll lx = -1, rx = 1e18 + 1;
	while (l <= r) {
		ll mn, mx;
		MinMax(lx, rx, &mn, &mx);
		// cout << '\t' << lx << ' ' << rx << ' ' << mn << ' ' << mx << endl;
		a[l++] = mn, a[r--] = mx;
		lx = mn + 1, rx = mx - 1;
	}
	ll ans = 0;
	for (int i = 1; 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...