제출 #12929

#제출 시각아이디문제언어결과실행 시간메모리
12929gs13068산악 구조대 (JOI13_mountain)C++98
0 / 100
12 ms512 KiB
#include "grader.h"
#include <algorithm>

void Rescue(int n,int m,int x,int y,int z)
{
    int i,j,t;
    i=1;
    j=y;
    while(i<=x&&j>=1)
	{
		t=Measure(i,j);
        if(t==z)
		{
			Pinpoint(i,j);
			return;
		}
        if(t>z)i++;
        else j--;
	}
    i=1;
    j=y;
    while(i<=x&&j<=m)
	{
		t=Measure(i,j);
        if(t==z)
		{
			Pinpoint(i,j);
			return;
		}
        if(t>z)i++;
        else j++;
	}
    i=n;
    j=y;
    while(i>=x&&j>=1)
	{
		t=Measure(i,j);
        if(t==z)
		{
			Pinpoint(i,j);
			return;
		}
        if(t>z)i--;
        else j--;
	}
    i=n;
    j=y;
    while(i>=x&&j<=m)
	{
		t=Measure(i,j);
        if(t==z)
		{
			Pinpoint(i,j);
			return;
		}
        if(t>z)i--;
        else j++;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...