Submission #1366274

#TimeUsernameProblemLanguageResultExecution timeMemory
1366274vahagngGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

long long findGap(int T, int N){
	long long mn = 0, mx = 1e18;
	set<long long> st;
	for(int i = 0; i < N / 2; i++){
		MinMax(mn, mx, &mn, &mx);
		st.insert(mn);
		st.insert(mx);
		a[N - i - 1] = mx;
	}
	if(N & 1){
		MinMax(mn, mx, &mn, &mx);
		st.insert(mn);
	}
	vector<long long> a;
	for(auto i : st) a.push_back(i);
	long long res = 0;
	for(int i = 1; i < N; i++){
		if(res < a[i] - a[i - 1]){
			res = a[i] - a[i - 1];
		}
	}
	return res;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:17: error: 'a' was not declared in this scope
   12 |                 a[N - i - 1] = mx;
      |                 ^