Submission #702361

# Submission time Handle Problem Language Result Execution time Memory
702361 2023-02-23T16:43:23 Z Cyanmond Chess Rush (CEOI20_chessrush) C++17
0 / 100
1 ms 300 KB
#include "arithmetics.h"
#include <bits/stdc++.h>

using i64 = long long;
i64 R;
int C, Q;

int main() {
    std::cin >> R >> C >> Q;

    auto solve1 = [&](int a, int b, i64 r = R, i64 c = C) -> std::pair<i64, i64> {
        if (a == b) {
            return {r - 1, 1};
        } else {
            return {0, 0};
        }
    };
    auto solve2 = [&](int a, int b, i64 r = R, i64 c = C) -> std::pair<i64, i64> {
        if (a == b) {
            return {1, 1};
        } else {
            return {2, 2};
        }
    };
    auto solve3 = [&](int a, int b) -> std::pair<i64, i64> {
        auto judge1Turn = [&](int a, int b, int r = R, int c = C) {
            if (std::max(a - b, (int)r - 1) <= 1) {
                return true;
            }
            if (a == b) {
                return true;
            }
            if (std::abs(a - b) == std::abs(r - 1)) {
                return true;
            }
            return false;
        };
        if (judge1Turn(a, b)) {
            return {1, 1};
        }

        int v = 4;
        const int w = std::abs(a - b);
        if (w != 1) {
            if (b - 1 == a) ++v;
            if (b + 1 == a) ++v;
            if (a - 1 == b) ++v;
            if (a + 1 == b) ++v;
        }
        if (R - 1 - w != 1) {
            if (judge1Turn(a, b, R - 1, C)) v += 2;
        }
        // r -> r
        int x = 1 + a;
        int y = R + b;
        if (x % 2 == y % 2) {
            if (a - 1 + b - 1 >= R - 1) ++v;
            if (C - a + C - b >= R - 1) ++v;
        }
        return {2, v};
    };
    auto solve4 = [&](int a, int b) -> std::pair<i64, i64> {
        return {-1, -1};
        int x = 1 + a;
        int y = R + b;
        if (x % 2 == y % 2) {
            
        }
    };
    auto solve5 = [&](int a, int b) -> std::pair<i64, i64> {
        return {-1, -1};
    };

    for (int q = 0; q < Q; ++q) {
        char T;
        int a, b;
        std::cin >> T >> a >> b;
        std::pair<i64, i64> answer = {-1, -1};
        if (T == 'P') answer = solve1(a, b);
        if (T == 'R') answer = solve2(a, b);
        if (T == 'Q') answer = solve3(a, b);
        if (T == 'B') answer = solve4(a, b);
        if (T == 'K') answer = solve5(a, b);
        std::cout << answer.first << ' ' << answer.second << std::endl;
    }
}
# 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 300 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 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 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 -