#P15715. [JAG 2023 Summer Camp #2] Knight Game

[JAG 2023 Summer Camp #2] Knight Game

题目描述

The rule of this game is given as follows.

  • There is a knight and a chessboard with HH rows and WW columns. The square at the ii-th row from the top and the jj-th column from the left is called square (i,j)(i, j). Initially, the knight is placed on square (x,y)(x, y).
  • Alice and Bob alternately take the following action, starting with Alice.
  • Move the knight onto one of the unvisited squares according to the knight's movement.
  • Knights can move from (x1,y1)(x_1, y_1) to (x2,y2)(x_2, y_2) if and only if (x1x2)2+(y1y2)2(x_1 - x_2)^2 + (y_1 - y_2)^2 is 55.
  • The player who cannot move the knight is the loser.

When both players have done their best, determine whether Alice or Bob will win. Answer for TT test cases.

The unvisited square is defined as follows.

  • A square on the board that the knight has never visited since the beginning of the game.

输入格式

$$\begin{aligned} &T \\ &case_1 \\ &\vdots \\ &case_T \end{aligned} $$

caseicase_i represents the ii-th test case.

Each test case is given in the following format.

H W x yH \ W \ x \ y

The input satisfies the following constraints.

  • All inputs consist of integers.
  • 1T2×1051 \leq T \leq 2 \times 10^5
  • 1H,W1091 \leq H, W \leq 10^9
  • 1xH1 \leq x \leq H
  • 1yW1 \leq y \leq W

输出格式

Output TT lines. On the line ii, answer the winner of the ii-th test case, Alice or Bob.

2
4 4 1 1
9 17 7 3
Alice
Bob