Submission #866502

# Submission time Handle Problem Language Result Execution time Memory
866502 2023-10-26T09:18:57 Z vjudge1 Radio Towers (IOI22_towers) C++17
Compilation error
0 ms 0 KB
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 3;
int p = 0;
int a[MAXN];
void init(int N, vector<int> H) {
	int mx = 0;
	for (int i = 0; i < N; i++){
		if (H[i] > mx) mx = H[i], p = i;
		a[i] = H[i];
	}
	return;
}

int max_towers(int L, int R, int D) {
	if (p != 0 && p != N-1 && a[p-1] <= a[p]-D && a[p+1] <= a[p]-D){
		return 2;
	}
	return 1;
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:17:21: error: 'N' was not declared in this scope
   17 |  if (p != 0 && p != N-1 && a[p-1] <= a[p]-D && a[p+1] <= a[p]-D){
      |                     ^