1738. Gameia

时间限制 1000 ms   内存限制 64 MB

Alice and Bob are playing a game called 'Gameia ? Gameia !'. The game goes like this :
0. There is a tree with all node unpainted initial.
1. Because Bob is the VIP player, so Bob has K chances to make a small change on the tree any time during the game if he wants, whether before or after Alice's action. These chances can be used together or separate, changes will happen in a flash. each change is defined as cut an edge on the tree.
2. Then the game starts, Alice and Bob take turns to paint an unpainted node, Alice go first, and then Bob.
3. In Alice's move, she can paint an unpainted node into white color.
4. In Bob's move, he can paint an unpainted node into black color, and what's more, all the other nodes which connects with the node directly will be painted or repainted into black color too, even if they are white color before.
5. When anybody can't make a move, the game stop, with all nodes painted of course. If they can find a node with white color, Alice win the game, otherwise Bob.
Given the tree initial, who will win the game if both players play optimally?

输入数据

The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with two integers N and K : the size of the tree and the max small changes that Bob can make.
The next line gives the information of the tree, nodes are marked from 1 to N, node 1 is the root, so the line contains N-1 numbers, the i-th of them give the farther node of the node i+1.

Limits
$T \leq 100$
$1 \leq N \leq 500$
$0 \leq K \leq 500$
$1 \leq Pi \leq i$

输出数据

For each test case output one line denotes the answer.
If Alice can win, output "Alice" , otherwise "Bob".

样例输入

复制
2
2 1
1
3 1
1 2 \n
 · \n
 \n
 · \n
 · \n

样例输出

复制
Bob
Alice   \n
     \n

提交

请先 登录

Source

2017 Multi-University Training Contest - Team 6

© 2024 FAQs Contact About