#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 |
- |