Submission #163206

#TimeUsernameProblemLanguageResultExecution timeMemory
163206TadijaSebez산악 구조대 (JOI13_mountain)C++11
100 / 100
20 ms896 KiB
#include "grader.h"
#include <vector>
using namespace std;
bool inside(int x, int y, int x1, int x2, int y1, int y2){ return x>=x1 && x<=x2 && y>=y1 && y<=y2;}
bool Search(int x, int y, pair<int,int> mv_lo, pair<int,int> mv_hi, int x1, int x2, int y1, int y2, int h)
{
	while(inside(x,y,x1,x2,y1,y2))
	{
		int tmp=Measure(x,y);
		if(tmp==h){ Pinpoint(x,y);return 1;}
		if(tmp>h) x+=mv_lo.first,y+=mv_lo.second;
		else x+=mv_hi.first,y+=mv_hi.second;
	}
	return 0;
}
void Rescue(int n, int m, int x, int y, int h)
{
	if(Search(x,m,{1,0},{0,-1},x,n,y,m,h)) return;
	if(Search(x-1,m,{-1,0},{0,-1},1,x-1,y,m,h)) return;
	if(Search(x,1,{1,0},{0,1},x,n,1,y-1,h)) return;
	if(Search(x-1,1,{-1,0},{0,1},1,x-1,1,y-1,h)) return;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...