F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Problem A. Game with string

Time 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
abc 1 1 2
 

Sample Output
Alice
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-05 14:00:48, Gzip enabled