제출 #1160435

#제출 시각아이디문제언어결과실행 시간메모리
1160435Doncho_BonbonchoGap (APIO16_gap)C++20
컴파일 에러
0 ms0 KiB
#include <algorithm>
#include <random>
#include <stdio.h>
#include <stdlib.h>
#include <vector>

#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

#ifndef LOCAL
#define cerr if(false) cerr
#endif

#define out( x ) #x << " = " << x << "  "
#define endl "\n"

template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }

typedef long long ll;
const ll mod = 1e9 +7;
const int MAX_N = 1e6 + 42;



ll a[MAX_N];
long long findGap(int subtask, int n){

	if( subtask == 1 ){
		int lInd = 1;
		int rInd = N;
		a[0] = -1;
		a[N+1] = ll(1e18 + 1LL );

		while( lInd <= rInd ){
			MinMax( a[lInd-1] +1, a[rInd+1]-1, &a[lInd], &a[rInd] );
			cerr << out( lInd ) << out( rInd ) << out( a[lInd] ) << out( a[rInd] ) << endl;
			lInd ++;
			rInd --;
		}

		for( int i=1 ; i <= N ; i++ ) cerr << a[i] << " ";
		cerr << endl;

		ll nas = 0;
		for( int i=1 ; i < N ; i++ ){
			cerr << out( i ) << out( a[i+1] - a[i] ) << endl;
			chkmax( nas, ll( a[i+1] - a[i] ) );
		}

		cerr << out( nas ) << endl;
		return nas;
	}else{
		// QJ MI KURA
		return -1;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:32:28: error: 'N' was not declared in this scope
   32 |                 int rInd = N;
      |                            ^