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. Initially, they are given a non-empty string s , consisting of lowercase Latin letters. The length of the string is even. Each player also has a string of their own, initially empty. Alice starts, then they alternate moves. In one move, a player takes either the first or the last letter of the string s , removes it from s and prepends (adds to the beginning) it to their own string. The game ends when the string s becomes empty. The winner is the player with a lexicographically smaller string. If the players ' strings are equal, then it 's a draw. A string a is lexicographically smaller than a string b if there exists such position i that a_j = b_j for all j < i and a_i < b_i . What is the result of the game if both players play optimally (e. xe2 x80 x89g. both players try to win; if they can 't, then try to draw)? The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. Each testcase consists of a single line -- a non-empty string s , consisting of lowercase Latin letters. The length of the string s is even. The total length of the strings over all testcases doesn 't exceed 2000 . For each testcase, print the result of the game if both players play optimally. If Alice wins, print "Alice". If Bob wins, print "Bob". If it 's a draw, print "Draw". One of the possible games Alice and Bob can play in the first testcase: Alice wins because "cef" < "ros". Neither of the players follows any strategy in this particular example game, so it doesn 't show that Alice wins if both play optimally. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
171447211 |
FatalityNT |
D |
Sept. 8, 2022, 8:44 p.m. |
OK |
C# 8 |
TESTS |
16 |
77 |
16281600 |
|
|
171447375 |
FatalityNT |
D |
Sept. 8, 2022, 8:47 p.m. |
OK |
C# 8 |
TESTS |
16 |
78 |
16281600 |
|
|
171447434 |
FatalityNT |
D |
Sept. 8, 2022, 8:49 p.m. |
OK |
C# 8 |
TESTS |
16 |
92 |
16384000 |
|
|
171442997 |
FatalityNT |
D |
Sept. 8, 2022, 7:31 p.m. |
OK |
C# 8 |
TESTS |
16 |
92 |
16384000 |
|
|
171447097 |
FatalityNT |
D |
Sept. 8, 2022, 8:42 p.m. |
OK |
C# 8 |
TESTS |
16 |
93 |
16179200 |
|
|
171446257 |
FatalityNT |
D |
Sept. 8, 2022, 8:27 p.m. |
OK |
C# 8 |
TESTS |
16 |
93 |
16179200 |
|
|
171445172 |
FatalityNT |
D |
Sept. 8, 2022, 8:11 p.m. |
OK |
C# 8 |
TESTS |
16 |
93 |
16384000 |
|
|
171447551 |
FatalityNT |
D |
Sept. 8, 2022, 8:51 p.m. |
OK |
C# 8 |
TESTS |
16 |
93 |
16384000 |
|
|
171445887 |
FatalityNT |
D |
Sept. 8, 2022, 8:22 p.m. |
OK |
C# 8 |
TESTS |
16 |
108 |
16281600 |
|
|
171445669 |
FatalityNT |
D |
Sept. 8, 2022, 8:18 p.m. |
OK |
C# 8 |
TESTS |
16 |
108 |
16384000 |
|
|
171445076 |
The_Meg |
D |
Sept. 8, 2022, 8:09 p.m. |
OK |
GNU C11 |
TESTS |
16 |
46 |
0 |
|
|
171455930 |
zlq7777 |
D |
Sept. 9, 2022, 12:41 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
0 |
0 |
|
|
171431737 |
Bob_Wang |
D |
Sept. 8, 2022, 5:23 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
0 |
0 |
|
|
171427287 |
Bit8 |
D |
Sept. 8, 2022, 4:50 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
0 |
0 |
|
|
171418853 |
water_mi |
D |
Sept. 8, 2022, 4:24 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
0 |
0 |
|
|
171465127 |
wust-zzl |
D |
Sept. 9, 2022, 4:16 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
0 |
0 |
|
|
171453600 |
Wak_Joyg |
D |
Sept. 8, 2022, 11:30 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
0 |
614400 |
|
|
171470103 |
Deft_t |
D |
Sept. 9, 2022, 5:43 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
15 |
0 |
|
|
171463918 |
__TRY_ |
D |
Sept. 9, 2022, 3:49 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
15 |
0 |
|
|
171463650 |
juruo_c |
D |
Sept. 9, 2022, 3:44 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
15 |
0 |
|
|
171462121 |
haoren258 |
D |
Sept. 9, 2022, 3:11 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
15 |
0 |
|
|
171435028 |
sandry24 |
D |
Sept. 8, 2022, 5:55 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
0 |
0 |
|
|
171465968 |
AnkitJha_alt |
D |
Sept. 9, 2022, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
0 |
0 |
|
|
171460774 |
MohamedEmadO_O |
D |
Sept. 9, 2022, 2:42 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
0 |
0 |
|
|
171457271 |
Mine_qihang |
D |
Sept. 9, 2022, 1:16 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
0 |
0 |
|
|
171453231 |
Abdelmohaymn |
D |
Sept. 8, 2022, 11:18 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
0 |
0 |
|
|
171451599 |
Akash_Chokhani |
D |
Sept. 8, 2022, 10:27 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
0 |
0 |
|
|
171430665 |
sheikhfoysal |
D |
Sept. 8, 2022, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
0 |
0 |
|
|
171426868 |
_Vanilla_ |
D |
Sept. 8, 2022, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
0 |
0 |
|
|
171426191 |
Hamine |
D |
Sept. 8, 2022, 4:44 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
0 |
0 |
|
|
171425182 |
Ganzagun2.0 |
D |
Sept. 8, 2022, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
0 |
0 |
|
|
171459736 |
Haven_ |
D |
Sept. 9, 2022, 2:17 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
0 |
0 |
|
|
171434367 |
bashkort |
D |
Sept. 8, 2022, 5:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
0 |
|
|
171429505 |
cheng1202 |
D |
Sept. 8, 2022, 5:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
0 |
|
|
171425957 |
sashasup |
D |
Sept. 8, 2022, 4:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
0 |
|
|
171418589 |
nimitt24 |
D |
Sept. 8, 2022, 4:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
0 |
|
|
171463995 |
Rick_GT |
D |
Sept. 9, 2022, 3:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
0 |
0 |
|
|
171427995 |
illume2021 |
D |
Sept. 8, 2022, 4:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
204800 |
|
|
171470874 |
starrall |
D |
Sept. 9, 2022, 5:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
15 |
0 |
|
|
171469970 |
laysan |
D |
Sept. 9, 2022, 5:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
15 |
0 |
|
|
171468167 |
Command_Button |
D |
Sept. 9, 2022, 5:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
15 |
0 |
|
|
171435955 |
IBN_Tarek |
D |
Sept. 8, 2022, 6:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
0 |
|
|
171470456 |
Sarthakhu |
D |
Sept. 9, 2022, 5:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171466103 |
yunny_world |
D |
Sept. 9, 2022, 4:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171463690 |
shaosy |
D |
Sept. 9, 2022, 3:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171459950 |
36champ |
D |
Sept. 9, 2022, 2:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171456500 |
bao_zi7 |
D |
Sept. 9, 2022, 12:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171445949 |
sankalp_gupta |
D |
Sept. 8, 2022, 8:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171445793 |
aalsalyed70 |
D |
Sept. 8, 2022, 8:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
0 |
0 |
|
|
171432704 |
AHF |
D |
Sept. 8, 2022, 5:33 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
0 |
|
|
171431586 |
Ahmed_Tarrek |
D |
Sept. 8, 2022, 5:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
0 |
|
|
171419796 |
TCchen |
D |
Sept. 8, 2022, 4:27 p.m. |
OK |
Java 11 |
TESTS |
12 |
155 |
0 |
|
|
171444579 |
theanmolsharma |
D |
Sept. 8, 2022, 8:02 p.m. |
OK |
Java 11 |
TESTS |
16 |
171 |
0 |
|
|
171426303 |
nebula6611 |
D |
Sept. 8, 2022, 4:45 p.m. |
OK |
Java 11 |
TESTS |
12 |
171 |
0 |
|
|
171424685 |
dzhi |
D |
Sept. 8, 2022, 4:37 p.m. |
OK |
Java 11 |
TESTS |
12 |
187 |
0 |
|
|
171429229 |
profchi |
D |
Sept. 8, 2022, 5:03 p.m. |
OK |
Java 11 |
TESTS |
12 |
1201 |
164454400 |
|
|
171455900 |
Mamimi |
D |
Sept. 9, 2022, 12:40 a.m. |
OK |
Java 17 |
TESTS |
16 |
217 |
20480000 |
|
|
171455346 |
ikillmyself |
D |
Sept. 9, 2022, 12:23 a.m. |
OK |
Java 8 |
TESTS |
16 |
124 |
5120000 |
|
|
171438272 |
NerfThis |
D |
Sept. 8, 2022, 6:29 p.m. |
OK |
Java 8 |
TESTS |
12 |
124 |
17408000 |
|
|
171420834 |
peiyeliu |
D |
Sept. 8, 2022, 4:29 p.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
17408000 |
|
|
171443975 |
The_terminator |
D |
Sept. 8, 2022, 7:50 p.m. |
OK |
Java 8 |
TESTS |
16 |
156 |
16896000 |
|
|
171466059 |
gosse |
D |
Sept. 9, 2022, 4:35 a.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
15 |
0 |
|
|
171435739 |
Ash_2k |
D |
Sept. 8, 2022, 6:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
218 |
112947200 |
|
|
171422091 |
Beacon |
D |
Sept. 8, 2022, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
93 |
2150400 |
|
|
171461807 |
abhipandey9315 |
D |
Sept. 9, 2022, 3:05 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
108 |
1433600 |
|
|
171454386 |
Jvaeyhcd |
D |
Sept. 8, 2022, 11:55 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
109 |
1843200 |
|
|
171449077 |
Gulu_Gulu |
D |
Sept. 8, 2022, 9:23 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
109 |
2048000 |
|
|
171427152 |
vaibhavmsra_78 |
D |
Sept. 8, 2022, 4:49 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
109 |
2252800 |
|
|
171449123 |
Gulu_Gulu |
D |
Sept. 8, 2022, 9:24 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
140 |
2048000 |
|
|
171469647 |
misorin |
D |
Sept. 9, 2022, 5:36 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
155 |
18841600 |
|
|
171450029 |
titia |
D |
Sept. 8, 2022, 9:46 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
233 |
19865600 |
|
|
171423240 |
Arsen4ikVar |
D |
Sept. 8, 2022, 4:33 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
467 |
26009600 |
|
|
171456590 |
sr_hossain |
D |
Sept. 9, 2022, 12:56 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
62 |
0 |
|
|
171430985 |
hsh8086 |
D |
Sept. 8, 2022, 5:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
62 |
1638400 |
|
|
171426358 |
Leocosmos |
D |
Sept. 8, 2022, 4:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
62 |
1740800 |
|
|
171439006 |
mintplz |
D |
Sept. 8, 2022, 6:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
77 |
2252800 |
|
|
171437913 |
sr3gm2 |
D |
Sept. 8, 2022, 6:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
77 |
2252800 |
|
|
171451713 |
oadey89 |
D |
Sept. 8, 2022, 10:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
93 |
3174400 |
|
|
171426588 |
samvel9 |
D |
Sept. 8, 2022, 4:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
108 |
3788800 |
|
|
171449143 |
AfsanHabib |
D |
Sept. 8, 2022, 9:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
109 |
3788800 |
|
|
171428977 |
Skillful_Wanderer |
D |
Sept. 8, 2022, 5:01 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
140 |
40550400 |
|
|
171422260 |
beethoven97 |
D |
Sept. 8, 2022, 4:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
171 |
11264000 |
|
|
171470226 |
2009amit0509 |
D |
Sept. 9, 2022, 5:45 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171468735 |
Leeisateam |
D |
Sept. 9, 2022, 5:22 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171468576 |
Leeisateam |
D |
Sept. 9, 2022, 5:20 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171468525 |
Leeisateam |
D |
Sept. 9, 2022, 5:19 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171468481 |
Leeisateam |
D |
Sept. 9, 2022, 5:19 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171468375 |
Leeisateam |
D |
Sept. 9, 2022, 5:17 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171466335 |
gandesaikiran8902 |
D |
Sept. 9, 2022, 4:40 a.m. |
OK |
Python 3 |
TESTS |
16 |
46 |
0 |
|
|
171444152 |
Aloui |
D |
Sept. 8, 2022, 7:54 p.m. |
OK |
Python 3 |
TESTS |
16 |
61 |
0 |
|
|
171440505 |
s_prateek26 |
D |
Sept. 8, 2022, 6:56 p.m. |
OK |
Python 3 |
TESTS |
12 |
872 |
79257600 |
|
|
171429807 |
xttt |
D |
Sept. 8, 2022, 5:07 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
15 |
0 |
|
|
171432423 |
liut |
D |
Sept. 8, 2022, 5:30 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
15 |
4403200 |
|
|
171426814 |
niyaznigmatul |
D |
Sept. 8, 2022, 4:47 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
15 |
16998400 |
|
|
171436457 |
robostac |
D |
Sept. 8, 2022, 6:09 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
342 |
81715200 |
|
|
remove filters
Back to search problems