9940 | 2024-03-20 19:28:25 | csdavid | Chess Rush | cpp17 | Wrong answer 0/100 | 4ms | 4616 KiB |
#include <iostream>
using namespace std;
int kezdoszlop, celoszlop;
int r, c, q;
char type;
void pawn(){
if(kezdoszlop!=celoszlop){
cout << 0 << ' ' << 0;
}
else{
cout << r-1 << ' ' << 1;
}
}
void rook(){
if(kezdoszlop==celoszlop){
cout << 1 << ' ' << 1;
}
else{
cout << 2 << ' ' << 2;
}
}
void queen(){
if(kezdoszlop==celoszlop||abs(celoszlop-kezdoszlop)==r-1){
cout << 1 << ' ' << 1;
}
else{
int ertek=4, kulonbseg;
if(r==c){
if(kezdoszlop==1){
ertek++;
}
if(celoszlop==1 || celoszlop==c){
ertek++;
}
}
if((abs(kezdoszlop-celoszlop)%2+r%2)%2){
kulonbseg=(r-abs(kezdoszlop-celoszlop)-1)/2;
if(min(celoszlop, kezdoszlop)-kulonbseg>=1){
ertek++;
}
if(max(celoszlop, kezdoszlop)+kulonbseg<=c){
ertek++;
}
}
//cout << min(celoszlop, kezdoszlop)-kulonbseg << ' ' << max(celoszlop, kezdoszlop)+kulonbseg << '\n';
cout << 2 << ' ' << ertek;
}
}
using namespace std;
int main()
{
cin >> r >> c >> q;
while(q--){
cin >> type >> kezdoszlop >> celoszlop;
if(type=='P'){
pawn();
}
else if(type=='R'){
rook();
}
else if(type=='Q'){
queen();
}
cout << '\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1876 KiB | ||||
2 | Wrong answer | 4ms | 2068 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Wrong answer | 3ms | 2156 KiB | ||||
4 | Accepted | 4ms | 2284 KiB | ||||
5 | Accepted | 3ms | 2488 KiB | ||||
6 | Wrong answer | 4ms | 2708 KiB | ||||
subtask3 | 0/15 | ||||||
7 | Wrong answer | 3ms | 2916 KiB | ||||
8 | Wrong answer | 3ms | 2996 KiB | ||||
9 | Wrong answer | 3ms | 3148 KiB | ||||
10 | Wrong answer | 3ms | 3016 KiB | ||||
subtask4 | 0/22 | ||||||
11 | Wrong answer | 4ms | 3012 KiB | ||||
12 | Wrong answer | 4ms | 3020 KiB | ||||
13 | Wrong answer | 4ms | 3028 KiB | ||||
14 | Wrong answer | 4ms | 3028 KiB | ||||
15 | Wrong answer | 4ms | 3024 KiB | ||||
16 | Wrong answer | 4ms | 3180 KiB | ||||
subtask5 | 0/5 | ||||||
17 | Wrong answer | 3ms | 3156 KiB | ||||
18 | Wrong answer | 3ms | 3220 KiB | ||||
19 | Wrong answer | 3ms | 3248 KiB | ||||
20 | Wrong answer | 3ms | 3364 KiB | ||||
subtask6 | 0/8 | ||||||
21 | Wrong answer | 4ms | 3436 KiB | ||||
22 | Wrong answer | 4ms | 3436 KiB | ||||
23 | Wrong answer | 4ms | 3572 KiB | ||||
24 | Wrong answer | 4ms | 3648 KiB | ||||
subtask7 | 0/15 | ||||||
25 | Wrong answer | 4ms | 3776 KiB | ||||
26 | Wrong answer | 4ms | 3864 KiB | ||||
27 | Wrong answer | 4ms | 3860 KiB | ||||
28 | Wrong answer | 4ms | 3864 KiB | ||||
29 | Wrong answer | 4ms | 3992 KiB | ||||
30 | Wrong answer | 3ms | 4236 KiB | ||||
subtask8 | 0/20 | ||||||
31 | Wrong answer | 4ms | 4292 KiB | ||||
32 | Wrong answer | 4ms | 4288 KiB | ||||
33 | Wrong answer | 4ms | 4288 KiB | ||||
34 | Wrong answer | 4ms | 4284 KiB | ||||
35 | Wrong answer | 4ms | 4288 KiB | ||||
36 | Wrong answer | 4ms | 4408 KiB | ||||
subtask9 | 0/7 | ||||||
37 | Wrong answer | 4ms | 4528 KiB | ||||
38 | Wrong answer | 4ms | 4616 KiB | ||||
39 | Wrong answer | 4ms | 4504 KiB | ||||
40 | Wrong answer | 4ms | 4500 KiB | ||||
41 | Wrong answer | 4ms | 4524 KiB | ||||
42 | Wrong answer | 4ms | 4596 KiB |