제출 #735837

#제출 시각아이디문제언어결과실행 시간메모리
735837Abrar_Al_SamitGap (APIO16_gap)C++17
30 / 100
41 ms1952 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

long long findGap(int T, int N) {
	int l = 1, r = N;

	long long a[N+1];
	long long lef = 1, rit = 1e18;
	while(l<=r) {
		MinMax(lef, rit, &lef, &rit);
		if(l==r) {
			a[l] = lef;
			break;
		} else {
			a[l] = lef, a[r] = rit;
			++lef, --rit;
			++l, --r;
		}
	}

	long long best = 0;
	for(int i=2; i<=N; ++i) {
		best = max(best, a[i] - a[i-1]);
	}
	return best;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...