#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "ABC"
#define pll pair<ll, ll>
#define pii pair< pll, ll >
#define fi first
#define se second
#include "grader.h"
using namespace std;
using ll = int;
using ull = unsigned long long;
const int N = 3e5+5;
const ll mod = 1e9+7;
const ll base1 = 1313;
const ll base2 = 3113;
string s;
ll pw(ll k, ll n)
{
ll total = 1;
for(; n; n >>= 1)
{
if(n & 1)total = total * k % mod;
k = k * k % mod;
}
return total;
}
void cal(ll xl, ll yl, ll xr, ll yr, ll u, ll v, ll val)
{
ll x = (u == 1 ? xl : xr);
ll y = (v == 1 ? yr : yl);
ll cur = Measure(x, y);
if(cur == val)
{
Pinpoint(x, y);
exit(0);
}
if(cur < val)
{
if(u == 1)cal(xl+1, yl, xr, yr, u, v, val);
else cal(xl, yl, xr-1, yr, u, v, val);
}
else
{
if(v == 1)cal(xl, yl, xr, yr-1, u, v, val);
else cal(xl, yl+1, xr, yr, u, v, val);
}
}
void Rescue ( int R, int C, int RS, int CS, int X)
{
cal(1, 1, RS, CS, 1, 1, X);
cal(RS, 1, R, CS, 0, 1, X);
cal(1, CS, RS, C, 1, 0, X);
cal(RS, CS, R, C, 0, 0, X);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Incorrect |
1 ms |
364 KB |
Wrong Answer [1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1004 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |