# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
372773 | Killer2501 | 케이크 (JOI13_cake) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}