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 <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int r, c, q;
cin >> r >> c >> q;
for(int i = 0; i < q; ++i) {
char t;
int c1, c2;
cin >> t >> c1 >> c2;
--c1; --c2;
if(t == 'P') {
if(c1 != c2) cout << "0 0\n";
else cout << r << " 1\n";
}
if(t == 'R') {
if(c1 == c2) cout << "1 1\n";
else cout << "2 2\n";
}
if(t == 'Q') {
if(c1 == c2) cout << "1 1\n";
else {
int nr = 4;
///asta se poate inlocuii cu un bishop + verificare cost = 2
if((c1 + c2 + r) % 2 == 1) {
int x1 = (c1 + c2 + r - 1) / 2;
int x2 = (c1 + c2 - (r - 1)) / 2;
if(x1 >= 0 && x1 < c) ++nr;
if(x2 >= 0 && x2 < c) ++nr;
}
cout << "2 " << nr << "\n";
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |