# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795974 | NeroZein | Chess Rush (CEOI20_chessrush) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#include "arithmetics.h"
#include "bits/stdc++.h"
using namespace std;
constexpr int P = 1e9+7;
int Add(int a, int b) {
int ret = a%P;
ret = (ret<0 ? P+ret : ret) + (b%P);
return (ret>=0 ? ret%P : ret+P);
}
int Sub(int a, int b) {
int ret = a%P;
ret = (ret<0 ? P+ret : ret) - (b%P);
return (ret>=0 ? ret%P : ret+P);
}
int Mul(int a, int b) {
int ret = (1ll*(a%P) * (b%P)) % P;
return (ret<0 ? P+ret : ret);
}
int modpow(int base, int exp, int modulus=P) {
base %= modulus;
int result = 1;
while (exp > 0) {
if (exp & 1) result = (1ll*result * base) % modulus;
base = (1ll*base * base) % modulus;
exp >>= 1;
}
return result;
}
int modinv(int a, int modulus=P) {
return modpow(a,modulus - 2);
}
int Div(int a, int b) {
int ret = b%P;
ret = (1ll*(a%P) * modinv(ret<0 ? P+ret : ret)) % P;
return (ret<0 ? P+ret : ret);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int r, c, q;
cin >> r >> c >> q;
while (q--) {
char p;
int c1, c2;
cin >> p >> c1 >> c2;
if (p == 'P') {
if (c1 == c2) {
cout << 1 << ' ' << 1 << '\n';
} else {
cout << 0 << ' ' << 0 << '\n';
}
}
else if (p == 'R') {
if (c1 == c2) {
cout << 1 << ' ' << 1 << '\n';
} else {
cout << 2 << ' ' << 2 << '\n';
}
}
else if (p == 'Q') {
if (c1 == c2) {
cout << 1 << ' ' << 1 << '\n';
} else {
cout << 2 << ' ' << 4 + (((r - 1) - abs(c2 - c1)) % 2 == 0) << '\n';
}
}
}
return 0;
}