Submission #1027766

#TimeUsernameProblemLanguageResultExecution timeMemory
1027766stdfloatGap (APIO16_gap)C++17
30 / 100
33 ms2872 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

using ll = long long;

ll findGap(int T, int N) {
	ll s, t;
	MinMax(0, (ll)1e18, &s, &t);

	int cnt = 1;
	ll ans = 0;
	while (++cnt <= ((N + 1) >> 1) && s + 1 < t) {
		ll x, y;
		MinMax(s + 1, t - 1, &x, &y);

		if (x == -1) break;
	
		ans = max({ans, x - s, t - y});
		s = x; t = y;
	}

	return max(ans, t - s);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...