Prefix-free Game

AtCoder
IDarc087_c
Time2000ms
Memory256MB
Difficulty
For strings $s$ and $t$, we will say that $s$ and $t$ are _prefix-free_ when neither is a prefix of the other. Let $L$ be a positive integer. A set of strings $S$ is a _good string set_ when the following conditions hold true: * Each string in $S$ has a length between $1$ and $L$ (inclusive) and consists of the characters `0` and `1`. * Any two distinct strings in $S$ are prefix-free. We have a good string set $S = { s_1, s_2, ..., s_N }$. Alice and Bob will play a game against each other. They will alternately perform the following operation, starting from Alice: * Add a new string to $S$. After addition, $S$ must still be a good string set. The first player who becomes unable to perform the operation loses the game. Determine the winner of the game when both players play optimally. ## Constraints * $1 \leq N \leq 10^5$ * $1 \leq L \leq 10^{18}$ * $s_1$, $s_2$, ..., $s_N$ are all distinct. * { $s_1$, $s_2$, ..., $s_N$ } is a good string set. * $|s_1| + |s_2| + ... + |s_N| \leq 10^5$ ## Input Input is given from Standard Input in the following format: $N$ $L$ $s_1$ $s_2$ $:$ $s_N$ [samples]
Samples
Input #1
2 2
00
01
Output #1
Alice

If Alice adds `1`, Bob will be unable to add a new string.
Input #2
2 2
00
11
Output #2
Bob

There are two strings that Alice can add on the first turn: `01` and `10`. In case she adds `01`, if Bob add `10`, she will be unable to add a new string. Also, in case she adds `10`, if Bob add `01`, she will be unable to add a new string.
Input #3
3 3
0
10
110
Output #3
Alice

If Alice adds `111`, Bob will be unable to add a new string.
Input #4
2 1
0
1
Output #4
Bob

Alice is unable to add a new string on the first turn.
Input #5
1 2
11
Output #5
Alice
Input #6
2 3
101
11
Output #6
Bob
API Response (JSON)
{
  "problem": {
    "name": "Prefix-free Game",
    "description": {
      "content": "For strings $s$ and $t$, we will say that $s$ and $t$ are _prefix-free_ when neither is a prefix of the other. Let $L$ be a positive integer. A set of strings $S$ is a _good string set_ when the follo",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc087_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For strings $s$ and $t$, we will say that $s$ and $t$ are _prefix-free_ when neither is a prefix of the other.\nLet $L$ be a positive integer. A set of strings $S$ is a _good string set_ when the follo...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments