Submission #623769

# Submission time Handle Problem Language Result Execution time Memory
623769 2022-08-06T13:12:55 Z iomoon191 산악 구조대 (JOI13_mountain) C++17
Compilation error
0 ms 0 KB
#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);
}

Compilation message

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