問題一覧 > 通常問題

No.3484 Just a Maze Game

レベル : / AI推定難易度 : 1775 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 51
作問者 : 👑 AngrySadEight / テスター : 👑 p-adic 👑 hamamu
お気に入りにしたユーザー ProblemId : 12930 / 自分の提出
問題文最終更新日: 2026-03-20 01:49:39
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 495 (順位表) の他の問題:

Problem Statement

You are given integers $N, M, B, W$. Alice and Bob play the following game.

  • Alice creates a maze consisting of a grid with $N$ rows and $M$ columns. The maze must consist of $B$ black cells and $W$ white cells (the constraints guarantee that $N \times M = B + W$).
  • Next, in the maze created by Alice, Bob chooses $2$ distinct white cells and designates them as the start cell and the goal cell, respectively. Furthermore, he chooses $1$ white cell that is neither the start cell nor the goal cell and turns it into a black cell.
  • Finally, if the goal cell can be reached from the start cell by repeatedly moving to a white cell adjacent vertically or horizontally, Alice wins; otherwise, Bob wins.

Determine who wins when both players act optimally.

You are given $T$ test cases; answer each of them.

Constraints

  • All input values are integers
  • $1 \leq T \leq 10^4$
  • $N, M \geq 1$
  • $3 \leq N \times M \leq 10^6$
  • $W \geq 3$
  • $B \geq 0$
  • $N \times M = B + W$
  • The sum of $N \times M$ in $1$ input file is at most $10^6$

Input

The input is given from standard input in the following format. Here, $\mathrm{case}_i$ represents the $i$-th test case.

$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\cdots$
$\mathrm{case}_T$

Each case is given in the following format.

$N$ $M$ $B$ $W$

Output

Output $T$ lines. On line $i(1 \leq i \leq T)$, output the name of the winner of the $i$-th test case.

Sample

Sample 1
Input
4
4 4 3 13
1 3 0 3
2 4 0 8
495 495 244530 495
Output
Alice
Bob
Alice
Alice

In test case $1$, as $1$ possible way for the game to proceed, Alice creates the following maze, and Bob decides the start, the goal, and the white cell to turn black as shown in the right figure.

In this case, Alice wins since the goal can be reached from the start. In fact, it can be shown that Alice wins when both players act optimally.

In test case $2$, there is only $1$ maze Alice can create, shown below. In this case, if Bob decides the start, the goal, and the white cell to turn black as shown in the right figure, the goal can no longer be reached from the start. Therefore, Bob wins.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。