This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
int V;
bool solve(int xa, int ya, int xb, int yb, int dx, int dy){
int x=xa, y=ya;
while(xa<=x-dx && x-dx<=xb) x-=dx;
while(ya<=y-dy && y-dy<=yb) y-=dy;
while(xa<=x && x<=xb && ya<=y && y<=yb){
int now = Measure(x,y);
if(now==V){ Pinpoint(x,y); return true; }
if(now<V) x+=dx;
if(now>V) y+=dy;
}
return false;
}
void Rescue(int R, int C, int RS, int CS, int X) {
V = X;
bool ans =
solve(1,1,RS,CS,1,-1) ||
solve(1,CS,RS,C,1,1) ||
solve(RS,1,R,CS,-1,-1) ||
solve(RS,CS,R,C,-1,1);
}
Compilation message (stderr)
mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:22:7: warning: unused variable 'ans' [-Wunused-variable]
bool ans =
^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |