이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |