Submission #1318588

#TimeUsernameProblemLanguageResultExecution timeMemory
1318588khanhphucscratchGap (APIO16_gap)C++20
30 / 100
41 ms2320 KiB
#include "gap.h"
#include<bits/stdc++.h>
#define int long long
using namespace std;
long long findGap(int32_t T, int32_t n)
{
	vector<int> a;
	int x = -1, y = 2e18;
	for(int i = 1; i <= (n+1)/2; i++){
        MinMax(x+1, y-1, &x, &y);
        a.push_back(x);
        if(x != y) a.push_back(y);
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for(int i = 1; i < a.size(); i++) ans = max(ans, a[i] - a[i-1]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...