답안 #1056048

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056048 2024-08-13T07:26:57 Z pawned 송신탑 (IOI22_towers) C++17
컴파일 오류
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) {
      |                   ^