#include "grader.h"
typedef int ll;
bool v = false;
void f(ll x1, ll y1, ll x2, ll y2, ll xd, ll yd, ll z)
{
if(x1 > x2 || y1 > y2) return;
if(xd == -1 && yd == -1)
{
ll t = Measure(x1, y2);
if(t == z)
{
v = true;
Pinpoint(x1, y2);
}
else if(t < z)
{
f(x1 + 1, y1, x2, y2, xd, yd, z);
}
else
{
f(x1, y1, x2, y2 - 1, xd, yd, z);
}
}
else if(xd == -1 && yd == 1)
{
ll t = Measure(x2, y2);
if(t == z)
{
v = true;
Pinpoint(x2, y2);
}
else if(t < z)
{
f(x1, y1, x2, y2 - 1, xd, yd, z);
}
else
{
f(x1, y1, x2 - 1, y2, xd, yd, z);
}
}
else if(xd == 1 && yd == 1)
{
ll t = Measure(x2, y1);
if(t == z)
{
v = true;
Pinpoint(x2, y1);
}
else if(t < z)
{
f(x1, y1, x2 - 1, y2, xd, yd, z);
}
else
{
f(x1, y1 + 1, x2, y2, xd, yd, z);
}
}
else
{
ll t = Measure(x1, y1);
if(t == z)
{
v = true;
Pinpoint(x1, y1);
}
else if(t < z)
{
f(x1, y1 + 1, x2, y2, xd, yd, z);
}
else
{
f(x1 + 1, y1, x2, y2, xd, yd, z);
}
}
}
void Rescue(ll R, ll C, ll RS, ll CS, ll X)
{
if(!v) f(1, 1, RS - 1, CS, -1, -1, X);
if(!v) f(1, CS + 1, RS, C, -1, 1, X);
if(!v) f(RS + 1, CS, R, C, 1, 1, X);
if(!v) f(RS, 1, R, CS - 1, 1, -1, X);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
808 KB |
Output is correct |
2 |
Correct |
5 ms |
688 KB |
Output is correct |
3 |
Correct |
5 ms |
716 KB |
Output is correct |
4 |
Correct |
4 ms |
716 KB |
Output is correct |
5 |
Correct |
5 ms |
776 KB |
Output is correct |
6 |
Correct |
4 ms |
796 KB |
Output is correct |
7 |
Correct |
5 ms |
800 KB |
Output is correct |
8 |
Correct |
5 ms |
860 KB |
Output is correct |
9 |
Correct |
5 ms |
820 KB |
Output is correct |
10 |
Correct |
5 ms |
684 KB |
Output is correct |
11 |
Correct |
5 ms |
804 KB |
Output is correct |
12 |
Correct |
7 ms |
776 KB |
Output is correct |
13 |
Correct |
4 ms |
716 KB |
Output is correct |
14 |
Correct |
5 ms |
808 KB |
Output is correct |
15 |
Correct |
4 ms |
788 KB |
Output is correct |
16 |
Correct |
4 ms |
680 KB |
Output is correct |
17 |
Correct |
4 ms |
756 KB |
Output is correct |
18 |
Correct |
4 ms |
800 KB |
Output is correct |
19 |
Correct |
5 ms |
824 KB |
Output is correct |
20 |
Correct |
5 ms |
796 KB |
Output is correct |
21 |
Correct |
4 ms |
756 KB |
Output is correct |
22 |
Correct |
4 ms |
824 KB |
Output is correct |
23 |
Correct |
5 ms |
804 KB |
Output is correct |
24 |
Correct |
5 ms |
788 KB |
Output is correct |
25 |
Correct |
5 ms |
804 KB |
Output is correct |
26 |
Correct |
5 ms |
736 KB |
Output is correct |
27 |
Correct |
4 ms |
784 KB |
Output is correct |
28 |
Correct |
4 ms |
780 KB |
Output is correct |
29 |
Correct |
5 ms |
744 KB |
Output is correct |
30 |
Correct |
7 ms |
796 KB |
Output is correct |
31 |
Incorrect |
4 ms |
708 KB |
Wrong Answer [5] |
32 |
Halted |
0 ms |
0 KB |
- |