![]() |
||||||||||
|
||||||||||
Problem A. Game with stringTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2825 Accepted Submission(s): 737 Problem Description Alice and Bob are playing a game with string. Given a string S = $S_1$...$S_n$. They choose m substrings from S, the ith substring is $S_{L_i}$...$S{R_i}$. Alice and Bob play alternately, with Alice going first. On a player’s turn, this player can add a character into one of those m substrings, but the character should be added in the front or in the end, and the new string should still be a substring of S. The player unable to make a valid move loses the game. Who will be the winner if both players move optimally? Input Input is given from Standard Input in the following format: S m $L_1$ $R_1$ $L_2$ $R_2$ ... ... ... $L_m$ $R_m$ Constraints 1 ≤ |S| ≤ 100000 1 ≤ m ≤ 100000 1 ≤ $L_i$ ≤ $R_i$≤ |S|(1 ≤ i ≤ m) characters in S are lowercase Output Print one line denotes the answer. If Alice can win, output “Alice”, otherwise “Bob”. Sample Input
Sample Output
Source | ||||||||||
|