제출 #1219423

#제출 시각아이디문제언어결과실행 시간메모리
1219423jay_jayjay산악 구조대 (JOI13_mountain)C++20
100 / 100
6 ms328 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...