Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'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 <= l <= r <= |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 <= |s| <= 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 <= m <= 10^5 ) -- the number of games to analyze. Each of the next m lines contains two integers l and r ( 1 <= l <= r <= |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. In the first example, In the second example Alice wins both game "bdb" and "aaccbdb". To win game "bdb" Alice can erase symbol 'd ', the game then goes independently on strings "b" and "b". Bob deletes one of this strings and the Alice deletes the other one and Bob is unable to move. To win game "aaccbdb" Alice can erase symbol 'd ', the game t'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
42444448 |
samjia2000 |
G |
Sept. 4, 2018, 1:22 a.m. |
OK |
GNU C++ |
TESTS |
33 |
717 |
209305600 |
|
2900 |
42449709 |
rainy_season |
G |
Sept. 4, 2018, 7:03 a.m. |
OK |
GNU C++ |
TESTS |
33 |
1762 |
263680000 |
|
2900 |
42451583 |
ccosi |
G |
Sept. 4, 2018, 8:29 a.m. |
OK |
GNU C++ |
TESTS |
33 |
1793 |
89190400 |
|
2900 |
42451774 |
ccosi |
G |
Sept. 4, 2018, 8:37 a.m. |
OK |
GNU C++ |
TESTS |
33 |
1840 |
89190400 |
|
2900 |
44751668 |
ReaLNero1 |
G |
Oct. 23, 2018, 8:17 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
420 |
43008000 |
|
2900 |
42659205 |
frodakcin |
G |
Sept. 8, 2018, 2:28 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
483 |
43008000 |
|
2900 |
44068898 |
luogu_bot3 |
G |
Oct. 10, 2018, 10:59 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
483 |
52224000 |
|
2900 |
44064731 |
mmmod_lqs |
G |
Oct. 10, 2018, 8:31 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
483 |
52224000 |
|
2900 |
46673713 |
fwat |
G |
Dec. 6, 2018, 8:32 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
499 |
43827200 |
|
2900 |
50194500 |
yrz |
G |
Feb. 19, 2019, 4:32 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
499 |
60313600 |
|
2900 |
42695988 |
ReaLNero1 |
G |
Sept. 9, 2018, 7:11 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
514 |
62668800 |
|
2900 |
42693523 |
tqyaaaaaaaang |
G |
Sept. 9, 2018, 4:46 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
514 |
62668800 |
|
2900 |
42662339 |
frodakcin |
G |
Sept. 8, 2018, 5:32 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
529 |
43008000 |
|
2900 |
50194985 |
vjudge5 |
G |
Feb. 19, 2019, 4:34 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
529 |
60313600 |
|
2900 |
44444825 |
newbiegcz |
G |
Oct. 17, 2018, 1:31 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
467 |
43008000 |
|
2900 |
50315276 |
RNS_KSB |
G |
Feb. 22, 2019, 11:57 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
468 |
43827200 |
|
2900 |
45803481 |
jslijin |
G |
Nov. 16, 2018, 2:36 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
545 |
44236800 |
|
2900 |
42484323 |
AwD |
G |
Sept. 5, 2018, 8:03 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
561 |
103628800 |
|
2900 |
42714956 |
Minnakhmetov |
G |
Sept. 9, 2018, 6:32 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
592 |
42393600 |
|
2900 |
42426035 |
apiadu |
G |
Sept. 3, 2018, 12:43 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
592 |
42393600 |
|
2900 |
50252115 |
Zayin |
G |
Feb. 20, 2019, 5:47 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
592 |
62668800 |
|
2900 |
50153438 |
liuhzh26 |
G |
Feb. 19, 2019, 8:41 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
592 |
62668800 |
|
2900 |
66446618 |
Toxel |
G |
Dec. 7, 2019, 9:53 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
592 |
67276800 |
|
2900 |
46740300 |
Marckess |
G |
Dec. 8, 2018, 1:30 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
623 |
26419200 |
|
2900 |
47314181 |
kczno1 |
G |
Dec. 21, 2018, 12:15 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
421 |
42188800 |
|
2900 |
42442709 |
ll931110 |
G |
Sept. 3, 2018, 10:39 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
561 |
43110400 |
|
2900 |
49109531 |
matthew99 |
G |
Jan. 28, 2019, 2:24 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
685 |
65740800 |
|
2900 |
64164660 |
Mai-sanBestWaifu |
G |
Nov. 3, 2019, 3:49 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
748 |
23654400 |
|
2900 |
42423188 |
Benq |
G |
Sept. 3, 2018, 11:23 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
764 |
52736000 |
|
2900 |
43000924 |
140870 |
G |
Sept. 17, 2018, 1:49 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
779 |
23654400 |
|
2900 |
42589029 |
HoBoCTb |
G |
Sept. 6, 2018, 5:38 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
779 |
23654400 |
|
2900 |
50387772 |
vjudge3 |
G |
Feb. 23, 2019, 1:04 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
795 |
31744000 |
|
2900 |
50386910 |
vjudge2 |
G |
Feb. 23, 2019, 12:38 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
795 |
31744000 |
|
2900 |
50259008 |
gamegame |
G |
Feb. 20, 2019, 9:50 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
826 |
43008000 |
|
2900 |
67588689 |
Ahmad |
G |
Dec. 25, 2019, 9:15 a.m. |
OK |
Java 8 |
TESTS |
33 |
3166 |
174489600 |
|
2900 |
69950051 |
dalt |
G |
Feb. 1, 2020, 8:41 a.m. |
OK |
Java 8 |
TESTS |
33 |
3946 |
91750400 |
|
2900 |
remove filters
Back to search problems