Submission #126584

#TimeUsernameProblemLanguageResultExecution timeMemory
126584jakob_noglerGap (APIO16_gap)C++14
30 / 100
54 ms1528 KiB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;

const ll inf = 1e18;

ll findGap(int T, int N){
	ll lo, hi, t_lo, t_hi, ans = 1, cnt = 2;
	MinMax(0, inf, &lo, &hi);

	while(lo < hi){
		t_lo = lo, t_hi = hi;
		//cout << cnt << " " << N << endl;
		if(cnt == N){
			ans = max(ans, hi - lo);
			break;
		}
		if(lo + 1 >= hi - 1) break;
		MinMax(lo + 1, hi - 1, &lo, &hi);
		ans = max(ans, t_hi - hi);
		ans = max(ans, lo - t_lo);
		cnt += 2;
	}

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...