Submission #12928

# Submission time Handle Problem Language Result Execution time Memory
12928 2015-01-20T15:26:39 Z gs13068 산악 구조대 (JOI13_mountain) C++
0 / 100
12 ms 768 KB
#include "grader.h"
#include <algorithm>

void Rescue(int n,int m,int x,int y,int z)
{
    int i,j,l,r,mid,t;
    l=0;
    r=n+m;
    while(r-l>1)
	{
		mid=(l+r)/2;
        for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)if(std::abs(i-x)+std::abs(j-y)==mid)break;
			if(j<=m)break;
		}
		if(i<=n)
		{
            t=Measure(i,j);
			if(t==z)
			{
				Pinpoint(i,j);
                return;
			}
            if(t>z)r=mid;
            else l=mid;
		}
		else r=mid;
	}
	for(i=1;i<=n;i++)for(j=1;j<=m;j++)if(std::abs(i-x)+std::abs(j-y)>=l&&std::abs(i-x)+std::abs(j-y)<=r)
	{
		t=Measure(i,j);
		if(t==z)
		{
			Pinpoint(i,j);
			return;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Incorrect 4 ms 256 KB Wrong Answer [5]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 768 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -