Submission #1241054

#TimeUsernameProblemLanguageResultExecution timeMemory
1241054thelegendary08Gap (APIO16_gap)C++17
0 / 100
28 ms1964 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
	if(T == 1){
		long long L = -1; long long R = 1e18 + 1; 
		long long mn, mx;
		vector<long long>v(N);
		int l = 0; int r = N-1;
		while(l <= r){
			MinMax(L+1, R-1, &mn, &mx);
			L = mn; R = mx;
			if(L == R){
				v[l] = L;
			}
			else{
				v[l] = mn; v[r] = mx;
			}
			l++; r--;
		}
		long long ans = 0;
		for(int i = 0; i<N-1; i++){
			if(ans < v[i+1] - v[i])ans = v[i+1] - v[i];
		}
		return ans;
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...