제출 #24893

#제출 시각아이디문제언어결과실행 시간메모리
24893khsoo01산악 구조대 (JOI13_mountain)C++11
100 / 100
18 ms1000 KiB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
int obj;

void solve (int xs, int xe, int ys, int ye, int cx, int cy, int dx, int dy) {
	while(xs <= cx && cx <= xe && ys <= cy && cy <= ye) {
		int cur = Measure(cx, cy);
		if(cur == obj) {Pinpoint(cx, cy); return;}
		cur < obj ? cx += dx : cy += dy;
	}
}

void Rescue (int R, int C, int RS, int CS, int X)
{
	obj = X;
	solve(1, RS, 1, CS, 1, CS, 1, -1);
	solve(RS, R, 1, CS, R, CS, -1, -1);
	solve(1, RS, CS, C, 1, CS, 1, 1);
	solve(RS, R, CS, C, R, CS, -1, 1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...