266 传统题

[CF2290E] 雪崩博弈 (Avalanche)

时间限制
2000ms
内存限制
256MiB
登顶 / 尝试
0/ 0
难度
4

[CF2290E] 雪崩博弈 (Avalanche)

Problem Statement

There are nn piles of stones in a line, numbered 11 through nn from left to right, initially containing a1,a2,…,ana_1, a_2, \dots, a_n stones. You are also given an integer kk.

Alice and Bob play a turn-based game with Alice going first. On a player's turn, they choose any non-empty pile ii, remove 11 stone from pile ii, and add 11 new stone to each of the up to kk piles immediately to its left (i.e., all piles jj with max⁡(1,i−k)≤j≤i−1\max(1, i - k) \le j \le i - 1; if i=1i = 1, no stones are added). There is an unlimited supply of new stones.

The player who cannot make a valid move (when all piles are empty) loses. It can be shown that the game always terminates in finitely many moves. Assuming optimal play from both players, determine who wins.

Input

The first line contains tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

The first line of each test case contains nn and kk (2≤n≤2⋅1052 \le n \le 2 \cdot 10^5, 1≤k≤n−11 \le k \le n - 1). The second line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n (0≤ai≤1090 \le a_i \le 10^9).

It is guaranteed that the sum of nn over all test cases does not exceed 2⋅1052 \cdot 10^5.

Output

For each test case, print "Alice" if Alice wins, or "Bob" if Bob wins.

Example

5
2 1
1 1
3 2
0 0 1
4 1
0 0 1 0
5 2
1 2 3 4 5
3 1
2 5 2
Alice
Bob
Alice
Alice
Bob

Note

  • Constraints: 1≤t≤1041 \le t \le 10^4, 2≤n≤2⋅1052 \le n \le 2 \cdot 10^5, 1≤k≤n−11 \le k \le n - 1, 0≤ai≤1090 \le a_i \le 10^9, ∑n≤2⋅105\sum n \le 2 \cdot 10^5.
  • Source: Codeforces 2290E · Avalanche