Submission #1056048

# Submission time Handle Problem Language Result Execution time Memory
1056048 2024-08-13T07:26:57 Z pawned Radio Towers (IOI22_towers) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

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

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

#include "towers.h"

int N;
vi H;
int maxv = -1;
int maxp = -1;

void init(int N_g, vi H_g) {
	N = N_g;
	H = H_g;
	for (int i = 0; i < N; i++) {
		if (H[i] > maxv) {
			maxv = H[i];
			maxp = i;
		}
	}
}

int max_towers(int L, int R, int D) {
	if (L <= maxp && r <= maxp) {
		if (H[L] <= maxv - D && H[R] <= maxv - D)
			return 2;
		return 1;
	}
	return 1;
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:32:19: error: 'r' was not declared in this scope
   32 |  if (L <= maxp && r <= maxp) {
      |                   ^