제출 #623769

#제출 시각아이디문제언어결과실행 시간메모리
623769iomoon191산악 구조대 (JOI13_mountain)C++17
컴파일 에러
0 ms0 KiB
#include <grader.h>
#include <bits/stdc++.h>
using namespace std;

int x_;

void sub(int x1, int x2, int y1, int y2, int cx, int cy, int dx, int dy){
	while(x1 <= cx and cx <= x2 and y1 <= cy and cy <= y2){
		int h = Measure(cx, cy);
		if(h == x_){
			Pinpoint(cx, cy);
		}
		else if(h < x_) cx += dx;
		else cy += dy;
	}
}

void Rescue(int r, int c, int rs, int cs, int x){
	_x = x;
	sub(1, rs, 1, cs, 1, cs, 1, -1);
	sub(rs, r, 1, cs, r, cs, -1, -1);
	sub(1, rs, cs, c, 1, cs, 1, 1);
	sub(rs, r, cs, c, r, cs, -1, 1);
}

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

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:19:2: error: '_x' was not declared in this scope; did you mean 'x'?
   19 |  _x = x;
      |  ^~
      |  x