제출 #416927

#제출 시각아이디문제언어결과실행 시간메모리
416927ACmachineChess Rush (CEOI20_chessrush)C++17
0 / 100
1 ms204 KiB
#include "arithmetics.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, j, k, l) for(int i = (j); i < (k); i += (l)) #define FORD(i,j , k, l) for(int i = (j); i >= (k); i -= (l)) #define REP(i, n) FOR(i, 0, n, 1) #define REPD(i, n) FORD(i, n, 0, 1) typedef long long ll; int main(){ int r, c, q; cin >> r >> c >> q; auto solve_pawn = [&](int c1, int cr)->array<int,2>{ if(c1 != cr) return {0, 0}; else{ return {r - 1, 1}; } }; auto solve_queen = [&](int c1, int cr)->array<int,2>{ if(c1 == cr){ return {1, 1}; } else if(abs(c1 - cr) == r - 1){ return {1, 1}; } else{ array<int, 2> res = {2, 4}; int tm = 1 + abs(cr - c1); if(c1 < cr && (r - tm) % 2 == 0 && cr + (r - tm) / 2 <= c) res[1]++; if(c1 > cr && (r - tm) % 2 == 0 && cr - (r - tm) / 2 >= 1) res[1]++; return res; } }; auto solve_rook = [&](int c1, int cr)->array<int,2>{ if(c1 == cr){ return {1, 1}; } else{ return {2, 2}; } }; REP(i, q){ char t; int c1, cr; cin >> t >> c1 >> cr; array<int, 2> res; if(t == 'P') res = solve_pawn(c1, cr); else if(t == 'Q') res = solve_queen(c1, cr); else if(t == 'R') res = solve_rook(c1, cr); cout << res[0] << " " << res[1] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...