#P15035. [UOI 2021 II Stage] 游戏
[UOI 2021 II Stage] 游戏
Background
Double experience: https://www.luogu.com.cn/problem/AT_arc087_c.
Problem Description
Cossack Moustache has come up with another problem for competitive programmers.
You are given a set of strings and a number .
A set of strings is called beautiful if and only if:
- Each string consists only of and ;
- The length of each string is at most ;
- No string is a prefix of another string.
The given set is beautiful.
Alice and Bob are playing the following game. They take turns to make a move. In each move, they may add a string to the set, provided that after adding it, the set is still beautiful. The player who cannot make a move loses.
Alice moves first. Help determine who will win if both players play optimally.
Input Format
The first line contains two integers (), which are the number of strings in the set and the maximum allowed length of strings in a beautiful set.
The next lines follow. The -th line contains a string ().
It is guaranteed that .
It is also guaranteed that the initial set is beautiful.
Output Format
If Alice wins, output Alice. If Bob wins, output Bob.
2 3
01
000
Bob
3 3
000
1
01
Alice
2 1
0
1
Bob
Hint
Scoring
- (2 points): .
- (6 points): .
- (8 points): .
- (12 points): .
- (17 points): .
- (20 points): .
- (35 points): No additional constraints.
Translated by ChatGPT 5