P16650 [CodeChef] TICTACTO
提高
题目描述

Read problem statements in [Mandarin], [Bengali], [Russian], and [Vietnamese] as well.

Two drunken players Alice and Bob are playing a modified version of Tic-Tac-Toe.

Initially, there is a $N \times M$ empty grid.

Alice and Bob take alternate turns starting with Alice. In her turn, Alice chooses an empty cell on the board and puts a "A" on the chosen cell. In Bob's turn, he chooses an empty cell and puts a "B" on the chosen cell.

The player who first gets any $K\times K$ subgrid completely filled with his/her initial wins the game. By a $K\times K$ subgrid, we mean the intersection of $K$ consecutive rows and $K$ consecutive columns. The players do not stop making turns after one of them wins and they play all $N \cdot M$ turns until the grid is filled.

You are given the sequence of moves played by each player (The cell selected by the player in his/her turn). You have to output the winner of the game or report that there is no winner.

------ Input ------

The first line contains an integer $T$, the number of test cases. Then the test cases follow.
The first line of each test case contains three integers $N$, $M$, $K$.
Each of the next $N\cdot M$ lines contains two integers $X$, $Y$ (the row and column of the cell chosen by the player with the current turn)

------ Output ------
For each test case, output "Alice" if Alice wins the game or "Bob" if Bob wins the game or "Draw" if no one wins.

------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ N, M ≤ 1000$
$1 ≤ K ≤ \min(N,M)$
$1 ≤ X ≤ N$
$1 ≤ Y ≤ M$
The sum of $N\cdot M$ over all test cases does not exceed $10^{6}$.

------ Subtasks ------

Subtask 1 (10 points): $1 ≤ N ≤ 10,\ 1 ≤ M ≤ 10$

Subtask 2 (20 points): $1 ≤ N ≤ 50,\ 1 ≤ M ≤ 50$

Subtask 3 (70 points): Original Constraints

------ Sample Input ------

1
3 4 2
1 1
3 1
1 2
2 3
2 1
2 4
3 2
3 4
1 3
3 3
2 2
1 4

------ Sample Output ------

Bob

------ Explanation ------
After $10$ turns of the game the state of the grid is:

AAA.
A.BB
BABB

At this moment, Bob has achieved a subgrid of $2 \times 2$ with his initials while Alice has not achieved it yet so Bob is the winner.

输入格式

见题面

输出格式

见题面

样例输入
1 3 4 2 1 1 3 1 1 2 2 3 2 1 2 4 3 2 3 4 1 3 3 3 2 2 1 4
样例输出
Bob