#include <bits/stdc++.h>
using namespace std;
int R,C,M;
void pawn(int a,int b){
if(a!=b) cout<<"0 0\n";
else cout<<R-1<<" 1\n";
}
void rook(int a,int b){
if(a==b) cout<<"1 1\n";
else cout<<"2 2\n";
}
void queen(int a,int b){
if(a==b || (a==1&&b==C&&R==C) || (a==C&&b==1&&R==C)) cout<<"1 1\n";
else {
int ans=4;
if(b<a) swap(a,b);
if((a==1 || b==C)&& R==C) ans++;
int k=R-(b-a)-1;
if(k%2==0){
if(a-k/2>=1) ans++;
if(b+k/2<=C) ans++;
}
cout<<"2 "<<ans<<"\n";
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
char a;
int b,c;
cin>>R>>C>>M;
for(int ii=1;ii<=M;ii++){
cin>>a>>b>>c;
if(a=='P') pawn(b,c);
else if(a=='R') rook(b,c);
else if(a=='Q') queen(b,c);
else if(a=='B') cout<<"0 0\n";
else if(a=='K') cout<<"0 0\n";
}
return 0;
}
# |
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 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
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 |
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 |
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 |
- |