제출 #414902

#제출 시각아이디문제언어결과실행 시간메모리
414902Pro_ktmr산악 구조대 (JOI13_mountain)C++17
100 / 100
21 ms916 KiB
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)

#include"grader.h"

void Rescue(int R, int C, int r, int c, int X){
	int x = c;
	bool flg = false;
	for(int y=1; y<=r; y++){
		if(!flg){
			int m = Measure(y, x);
			if(m == X){
				Pinpoint(y, x);
				return;
			}
			if(m >= X) flg = true;
		}
		while(x < C){
			int m = Measure(y, x+1);
			if(m == X){
				Pinpoint(y, x+1);
				return;
			}
			if(m >= X) x++;
			else break;
		}
	}
	x = max(1,c-1);
	flg = false;
	for(int y=1; y<=r; y++){
		if(!flg){
			int m = Measure(y, x);
			if(m == X){
				Pinpoint(y, x);
				return;
			}
			if(m >= X) flg = true;
		}
		while(x > 1){
			int m = Measure(y, x-1);
			if(m == X){
				Pinpoint(y, x-1);
				return;
			}
			if(m >= X) x--;
			else break;
		}
	}
	x = c;
	flg = false;
	for(int y=R; y>r; y--){
		if(!flg){
			int m = Measure(y, x);
			if(m == X){
				Pinpoint(y, x);
				return;
			}
			if(m >= X) flg = true;
		}
		while(x < C){
			int m = Measure(y, x+1);
			if(m == X){
				Pinpoint(y, x+1);
				return;
			}
			if(m >= X) x++;
			else break;
		}
	}
	x = max(1, c-1);
	flg = false;
	for(int y=R; y>r; y--){
		if(!flg){
			int m = Measure(y, x);
			if(m == X){
				Pinpoint(y, x);
				return;
			}
			if(m >= X) flg = true;
		}
		while(x > 1){
			int m = Measure(y, x-1);
			if(m == X){
				Pinpoint(y, x-1);
				return;
			}
			if(m >= X) x--;
			else break;
		}
	}

	while(true){

	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...