#include "bits/stdc++.h"
using namespace std;
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 (r - 1 == abs(c2 - c1)) {//diagonal
cout << 1 << ' ' << 1 << '\n';
}
else if (c1 == c2) {
cout << 1 << ' ' << 1 << '\n';
} else {
cout << 2 << ' ' << 4 + (((r - 1) + abs(c2 - c1)) % 2 == 0) << '\n';
}
} else {
cout << 0 << ' ' << 0 << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |