#include "grader.h"
int meas(int y, int x) {
return Measure(y+1, x+1);
}
void Rescue(int n, int m, int ys, int xs, int Z) {
//Measure(1, 2);
//Pinpoint(1, 2);
xs--; ys--;
int y=0, x=xs;
while(x<m && y<=ys) {
int z = meas(y, x);
if(z==Z) { Pinpoint(y+1,x+1); return; }
else if(z<Z) y++;
else x++;
}
x=m-1, y=ys;
while(y<n && x>=xs) {
int z = meas(y, x);
if(z==Z) { Pinpoint(y+1,x+1); return; }
else if(z<Z) x--;
else y++;
}
x=xs, y=n-1;
while(x>=0 && y>=ys) {
int z = meas(y, x);
if(z==Z) { Pinpoint(y+1,x+1); return; }
else if(z<Z) y--;
else x--;
}
x=0, y=ys;
while(x<=xs && y>=0) {
int z = meas(y, x);
if(z==Z) { Pinpoint(y+1,x+1); return; }
else if(z<Z) x++;
else y--;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |