99392024-03-20 19:11:52csdavidChess Rushcpp17Wrong answer 0/1004ms4720 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++;
            }
        }
        kulonbseg=(r-abs(kezdoszlop-celoszlop)-1)/2;
        if(min(celoszlop, kezdoszlop)-kulonbseg>=1){
            ertek++;
        }
        if(max(celoszlop, kezdoszlop)+kulonbseg<=c){
            ertek++;
        }

        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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1752 KiB
2Wrong answer4ms1988 KiB
subtask20/8
3Wrong answer3ms2200 KiB
4Accepted4ms2408 KiB
5Accepted3ms2900 KiB
6Wrong answer4ms2864 KiB
subtask30/15
7Wrong answer2ms2872 KiB
8Wrong answer3ms2996 KiB
9Wrong answer3ms3160 KiB
10Wrong answer3ms3232 KiB
subtask40/22
11Wrong answer4ms3480 KiB
12Wrong answer4ms3484 KiB
13Wrong answer4ms3628 KiB
14Wrong answer4ms3516 KiB
15Wrong answer4ms3796 KiB
16Wrong answer4ms3736 KiB
subtask50/5
17Wrong answer3ms3764 KiB
18Wrong answer3ms3872 KiB
19Wrong answer3ms3876 KiB
20Wrong answer3ms3912 KiB
subtask60/8
21Wrong answer4ms3880 KiB
22Wrong answer4ms3972 KiB
23Wrong answer4ms4088 KiB
24Wrong answer4ms4028 KiB
subtask70/15
25Wrong answer4ms4156 KiB
26Wrong answer4ms4172 KiB
27Wrong answer4ms4280 KiB
28Wrong answer4ms4280 KiB
29Wrong answer4ms4276 KiB
30Wrong answer3ms4296 KiB
subtask80/20
31Wrong answer4ms4360 KiB
32Wrong answer4ms4468 KiB
33Wrong answer4ms4356 KiB
34Wrong answer4ms4476 KiB
35Wrong answer4ms4468 KiB
36Wrong answer4ms4468 KiB
subtask90/7
37Wrong answer4ms4720 KiB
38Wrong answer4ms4596 KiB
39Wrong answer4ms4520 KiB
40Wrong answer4ms4640 KiB
41Wrong answer4ms4520 KiB
42Wrong answer4ms4516 KiB