#P11010. 『STA - R7』Divide and Merge Game

『STA - R7』Divide and Merge Game

Problem Description

Given two positive integers n,k(2kn)n, k(2 \le k \le n), Alice and Bob will play the following game:

  • Alice needs to provide a sequence aa of length kk consisting of positive integers, such that i=1kai=n\sum\limits_{i = 1}^{k} a_i = n.

  • Bob needs to try to give a positive integer mm with m2m \ge 2, such that the positive integer sequence aa given by Alice can be partitioned into mm non-empty multisets, and the sums of elements in these multisets are all equal. If Bob can give such an integer mm, then Bob wins; otherwise, Alice wins.

Assuming both players use optimal strategies, determine who will win. You need to answer TT queries.

Input Format

This problem contains multiple queries in a single test file.

The first line contains a positive integer TT, representing the number of queries.

For each query: one line contains two positive integers n,kn, k, with the meaning described in the Description.

Output Format

For each query, output one line Alice or Bob, indicating who will win.

2
4 4
8 3

Bob
Alice

Hint

Sample Explanation

For the first group of testdata, Alice can only provide the positive integer sequence {1,1,1,1}\left\{1,1,1,1\right\}. Then Bob gives m=4m = 4 and partitions the sequence into $\left\{\left\{1\right\},\left\{1\right\},\left\{1\right\},\left\{1\right\}\right\}$. Bob can also give m=2m = 2 and partition the sequence into $\left\{\left\{1, 1\right\}, \left\{1, 1\right\}\right\}$, obtaining two multisets whose element sums are both 22, which also satisfies the requirement.

For the second group of testdata, Alice can provide the positive integer sequence {3,2,3}\left\{3, 2, 3\right\}. It can be proven that Bob has no valid partition plan at this time, so Alice wins.

Constraints

This problem uses bundled tests.

For 100%100\% of the data:

  • 1T2×1051 \le T \le 2 \times 10^5;
  • 2kn1082 \le k \le n \le 10^8.

The detailed subtask allocation is as follows:

Subtask ID Constraints Score
1 n10n \le 10 1616
2 k2nk^2 \le n 2727
3 2n2 \nmid n
4 No special restrictions 3030

Translated by ChatGPT 5