Submission #882394

#TimeUsernameProblemLanguageResultExecution timeMemory
882394dubabubaGap (APIO16_gap)C++14
0 / 100
43 ms4564 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define ff first
#define ss second

ll findGap(int T, int N) {
	ll L, R;
	MinMax(0LL, (ll)1e18 + 10, &L, &R);

	ll d = (R - L) / (ll)N;
	ll mn[N], mx[N];
	mn[0] = L, mx[N - 1] = R;

	for(int i = 0; i < N; i++)
		MinMax(L + d * i, L + d * (i + 1), &mn[i], &mx[i]);
		
	ll ans = 0;
	for(int i = 1; i < N; i++)
		ans = max(ans, mn[i] - mx[i - 1]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...