305472: CF1037G. A Game on Strings
Memory Limit:256 MB
Time Limit:4 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
A Game on Strings
题意翻译
Alice和Bob正在玩一个字符串游戏。初始时他们有一个字符串$t$,只包含小写字母,然后不断进行如下操作直到无字符串: 选定一个字符串,从中任选一个字母,把该字符串按照该字母分成若干段,并删去所有该字母。每一段都成为一个新的字符串,轮换到下一个人继续这一步。 题目给定一个字符串$t$,接下来有$m$个询问,每个询问包含两个数$l,r$,表示初始字符串为$[l,r]$中的子串。请问谁有必胜策略。题目描述
Alice and Bob are playing a game on strings. Initially, they have some string $ t $ . In one move the first player selects the character $ c $ present in $ t $ and erases all it's occurrences in $ t $ , thus splitting $ t $ into many smaller strings. The game then goes independently with each of the strings — to make the move player selects one of the strings and one of the characters there, deletes all occurrences and adds the remaining string back to the game. Alice always starts the game, and then Alice and Bob take turns making moves. The player who is unable to make a move (because there is no string left) loses. Alice and Bob used to always start with a string $ s $ , but recently they found out that this became too boring. Now before each game they choose two integers $ l $ and $ r $ such that $ 1 \le l \le r \le |s| $ and play the game with the string $ s_{l} s_{l+1} s_{l+2} \ldots s_{r} $ instead. Given the string $ s $ and integers $ l $ , $ r $ for each game. Find who is going to win each game assuming they are smart and are playing optimally.输入输出格式
输入格式
The first line contains the string $ s $ ( $ 1 \le |s| \le 10^5 $ ) consisting of lowercase English letters. This is the string Alice and Bob used to start with. The second line contains a single integer $ m $ ( $ 1 \le m \le 10^5 $ ) — the number of games to analyze. Each of the next $ m $ lines contains two integers $ l $ and $ r $ ( $ 1 \le l \le r \le |s| $ ) — the bounds of the starting substring in the string $ s $ .
输出格式
For each game output a single line containing the name of the winner — "Alice" or "Bob" respectively.
输入输出样例
输入样例 #1
aaab
2
1 2
1 4
输出样例 #1
Alice
Bob
输入样例 #2
aaccbdb
2
5 7
1 7
输出样例 #2
Alice
Alice