Knight Game

시간 제한2초메모리 제한1024 MB

요약
H x W로 매우 큰 체스판의 (x,y)에서 나이트가 시작해, 갈 수 있는 방문하지 않은 칸으로 번갈아 이동하며 이동할 수 없는 쪽이 지는 게임의 승자를 판정한다.
난이도

어려움10점 중 8점

유형
게임 이론, 수학, 구현
정답자
아직 제출이 없습니다

문제

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 (x_1,y_1)(x\_1,y\_1)to (x_2,y_2)(x\_2, y\_2) if and only if (x_1−x_2)2+(y_1−y_2)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.

입력

TT

case_1\text{case}\_1

⋮\vdots

case_T\text{case}\_T

case_i\text{case}\_i represents the ii-th test case.

Each test case is given in the following format.

HH WW xx yy

출력

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

제한

  • All inputs consist of integers.
  • 1≤T≤2×1051 \le T \le 2 \times 10^5
  • 1≤H,W≤1091 \le H, W \le 10^9
  • 1≤x≤H1 \le x \le H
  • 1≤y≤W1 \le y \le W

예제1

  1. 예제 1

    입력
    2
    4 4 1 1
    9 17 7 3
    
    예상 출력
    Alice
    Bob