Codeforces Round 1073 (Div. 1)
A
Sorting Game
Codeforces
1200
原题
←B1 →
翻译中…

Alice and Bob play a game on a binary string $s$ of length $n$ (a string consisting only of characters $\mathtt{0}$ and $\mathtt{1}$). Alice moves first, and the players take alternate turns.

翻译中…

In one turn, a player chooses a sequence of indices $i_1, i_2, \ldots, i_m$ ($1 \le i_1 \lt i_2 \lt \ldots \lt i_m \le n$) such that the characters at these positions form a non-increasing sequence (that is, $s_{i_1} \ge s_{i_2} \ge \ldots \ge s_{i_m}$). The player then rearranges the characters at these positions to be sorted in non-decreasing order.

翻译中…

Formally, let the chosen characters consist of $z$ zeros and $o$ ones (where $z + o = m$). The move replaces the characters at positions $i_1, i_2, \ldots, i_m$ with a sequence of $z$ zeros followed by $o$ ones. A move is valid if and only if it strictly modifies the string $s$ (which implies $z \ge 1$ and $o \ge 1$).

翻译中…

The player who cannot make a valid move loses.

翻译中…

Assuming both players play optimally, determine the winner. If Alice wins, output a valid first move that is part of a winning strategy.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The first line of each test case consists of a single integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the length of the string $s$.

翻译中…

The second line of each test case contains a binary string $s$ of length $n$ consisting of only characters $\mathtt{0}$ and $\mathtt{1}$.

翻译中…

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

翻译中…

Output

翻译中…

For each test case, output one or three lines:

翻译中…
  • If Bob wins with optimal play, print a single line containing "Bob".
  • Otherwise, print three lines. On the first line print "Alice". On the second line print an integer $m$ ($2 \le m \le n$), and on the third line print $m$ distinct integers $i_1, i_2, \ldots, i_m$ ($1 \le i_1 \lt i_2 \lt \ldots \lt i_m \le n$) — the indices chosen for Alice's first move.
翻译中…

The sequence of indices you print must form a valid move according to the rules described in the statement. The indices must be printed in increasing order. If there are multiple winning moves, you may output any of them.

翻译中…

Note

翻译中…

In the first example, there is no way to make a move after which $s$ will change, so Bob wins immediately.

翻译中…

In the third example, Alice can choose a subsequence $[1, 2]$ and sort it, after which $s$ will turn into $\mathtt{011}$. After that, Bob can't make a move, so Alice wins.

翻译中…

样例

Input #1
3
3
000
2
10
3
101
Output #1
Bob
Alice
2
1 2
Alice
2
1 2
InputCopy OutputCopy
题目信息
题号
2190A
时间限制
2 s
内存限制
256 MB
标签
构造
博弈论
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。