Submission #1014292

#TimeUsernameProblemLanguageResultExecution timeMemory
1014292aufanGap (APIO16_gap)C++17
30 / 100
55 ms3596 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

const long long inff = 1e18;

long long findGap(int t, int n) {
	if (t == 1) {
		long long l = 0, r = inff;
		vector<long long> a(n);
		for (int i = 0; i < (n + 1) / 2; i++) {
			long long mn, mx;
			MinMax(l, r, &mn, &mx);
			a[i] = mn;
			a[n - 1 - i] = mx;
			l = mn + 1;
			r = mx - 1;
		}

		long long res = 0;
		for (int i = 0; i < n - 1; i++) res = max(res, a[i + 1] - a[i]);

		return res;
	} else if (t == 2) {

	}
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...