제출 #1234554

#제출 시각아이디문제언어결과실행 시간메모리
1234554Ghulam_Junaid송신탑 (IOI22_towers)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;

int k;
vector<int> a;
void init(int n, vector<int> h) {
    a = h;
    k = 0;
    while (k + 1 < n and h[k] < h[k + 1])
        k++;
}

int max_towers(int L, int R, int D) {
    return 1 + (L < k and k < R and h[R] + D <= h[k] and h[L] + D <= h[k]);
}

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

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:15:37: error: 'h' was not declared in this scope
   15 |     return 1 + (L < k and k < R and h[R] + D <= h[k] and h[L] + D <= h[k]);
      |                                     ^