제출 #1366274

#제출 시각아이디문제언어결과실행 시간메모리
1366274vahagngGap (APIO16_gap)C++20
컴파일 에러
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;
}

컴파일 시 표준 에러 (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;
      |                 ^