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'The only difference between the easy and hard versions is that the given string s in the easy version is initially a palindrome, this condition is not always true for the hard version. A palindrome is a string that reads the same left to right and right to left. For example, "101101" is a palindrome, while "0101" is not. Alice and Bob are playing a game on a string s of length n consisting of the characters '0 ' and '1 '. Both players take alternate turns with Alice going first. In each turn, the player can perform one of the following operations: Reversing a string means reordering its letters from the last to the first. For example, "01001" becomes "10010" after reversing. The game ends when every character of string becomes '1 '. The player who spends minimum dollars till this point wins the game and it is a draw if both spend equal dollars. If both players play optimally, output whether Alice wins, Bob wins, or if it is a draw. The first line contains a single integer t ( 1 <= t <= 10^3 ). Then t test cases follow. The first line of each test case contains a single integer n ( 1 <= n <= 10^3 ). The second line of each test case contains the string s of length n , consisting of the characters '0 ' and '1 '. It is guaranteed that the string s contains at least one '0 '. Note that there is no limit on the sum of n over test cases. For each test case print a single word in a new line: In the first test case of example, In the second test case of example, '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
116849202 |
bhujia_monster |
B2 |
May 20, 2021, 6:03 p.m. |
OK |
GNU C11 |
TESTS |
41 |
31 |
0 |
|
1900 |
116856675 |
mihirg42 |
B2 |
May 20, 2021, 7:44 p.m. |
OK |
GNU C11 |
TESTS |
41 |
139 |
0 |
|
1900 |
116865059 |
ncuPeterliang |
B2 |
May 21, 2021, 12:12 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
0 |
|
1900 |
116847530 |
Rick_007 |
B2 |
May 20, 2021, 5:49 p.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
0 |
|
1900 |
116865710 |
li0201 |
B2 |
May 21, 2021, 12:39 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
0 |
|
1900 |
116867379 |
final_trump LegendaryYYQ Lappland_Texas |
B2 |
May 21, 2021, 1:38 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
0 |
|
1900 |
116872797 |
kldrgon |
B2 |
May 21, 2021, 3:32 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116865029 |
ww117755 |
B2 |
May 21, 2021, 12:11 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
30 |
307200 |
|
1900 |
116876774 |
Ithea |
B2 |
May 21, 2021, 4:35 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
0 |
|
1900 |
116875004 |
foreverSeven |
B2 |
May 21, 2021, 4:08 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
0 |
|
1900 |
116877342 |
Cccc23333 |
B2 |
May 21, 2021, 4:43 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
0 |
|
1900 |
116877128 |
Ithea |
B2 |
May 21, 2021, 4:40 a.m. |
OK |
GNU C++11 |
TESTS |
41 |
31 |
0 |
|
1900 |
116839944 |
Ice_Cream |
B2 |
May 20, 2021, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
30 |
0 |
|
1900 |
116845424 |
Mr.vajpayee |
B2 |
May 20, 2021, 5:35 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116850302 |
elowen |
B2 |
May 20, 2021, 6:14 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116875797 |
_hecxoc |
B2 |
May 21, 2021, 4:21 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116866279 |
_Ruri_ |
B2 |
May 21, 2021, 1:02 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116860663 |
Ertugrul28 |
B2 |
May 20, 2021, 9:11 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116857824 |
sidO_O |
B2 |
May 20, 2021, 8:06 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116856991 |
abdelrahman011 |
B2 |
May 20, 2021, 7:49 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116878526 |
I_francis |
B2 |
May 21, 2021, 4:59 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116876460 |
_hecxoc |
B2 |
May 21, 2021, 4:31 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
31 |
0 |
|
1900 |
116852139 |
hajibaghlol |
B2 |
May 20, 2021, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
0 |
|
1900 |
116868053 |
cyc4188 |
B2 |
May 21, 2021, 2 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
0 |
|
1900 |
116839818 |
katoli |
B2 |
May 20, 2021, 4:31 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116866392 |
udbhav99 |
B2 |
May 21, 2021, 1:06 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116871931 |
Vishal-k |
B2 |
May 21, 2021, 3:19 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116870960 |
kaneki99 |
B2 |
May 21, 2021, 3:01 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116849490 |
Legendary_Loser |
B2 |
May 20, 2021, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116842283 |
Iqbal_Bappy |
B2 |
May 20, 2021, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
30 |
204800 |
|
1900 |
116882734 |
68686868 |
B2 |
May 21, 2021, 5:55 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
31 |
0 |
|
1900 |
116882666 |
Nuist_vida |
B2 |
May 21, 2021, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
41 |
31 |
0 |
|
1900 |
116849441 |
Abhitipu |
B2 |
May 20, 2021, 6:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
0 |
|
1900 |
116868947 |
CODERGARV |
B2 |
May 21, 2021, 2:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
0 |
|
1900 |
116860866 |
ale_naser_pastoriza |
B2 |
May 20, 2021, 9:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
0 |
|
1900 |
116854276 |
_riddle_ |
B2 |
May 20, 2021, 7:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
0 |
|
1900 |
116865332 |
fr1234 |
B2 |
May 21, 2021, 12:24 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116858319 |
taruntk |
B2 |
May 20, 2021, 8:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116878088 |
RP_21 |
B2 |
May 21, 2021, 4:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116858195 |
just_another_fool |
B2 |
May 20, 2021, 8:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116849628 |
nprakhar0411 |
B2 |
May 20, 2021, 6:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116880078 |
ks3rr |
B2 |
May 21, 2021, 5:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
30 |
102400 |
|
1900 |
116875112 |
0x3F |
B2 |
May 21, 2021, 4:10 a.m. |
OK |
Go |
TESTS |
41 |
46 |
102400 |
|
1900 |
116881595 |
0x3F |
B2 |
May 21, 2021, 5:41 a.m. |
OK |
Go |
TESTS |
41 |
62 |
102400 |
|
1900 |
116850221 |
_merlin_ |
B2 |
May 20, 2021, 6:14 p.m. |
OK |
Java 11 |
TESTS |
41 |
187 |
0 |
|
1900 |
116857865 |
amit_chas |
B2 |
May 20, 2021, 8:07 p.m. |
OK |
Java 11 |
TESTS |
41 |
187 |
0 |
|
1900 |
116883045 |
pravin_as |
B2 |
May 21, 2021, 5:59 a.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116878788 |
saurabh_kl |
B2 |
May 21, 2021, 5:03 a.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116850948 |
ishaanahuja101 |
B2 |
May 20, 2021, 6:21 p.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116840376 |
nick_301 |
B2 |
May 20, 2021, 4:32 p.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116859811 |
adarsh_goku |
B2 |
May 20, 2021, 8:49 p.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116877845 |
ypa |
B2 |
May 21, 2021, 4:50 a.m. |
OK |
Java 11 |
TESTS |
41 |
202 |
0 |
|
1900 |
116872228 |
pikachu_pika_pika |
B2 |
May 21, 2021, 3:23 a.m. |
OK |
Java 11 |
TESTS |
41 |
217 |
0 |
|
1900 |
116877261 |
kartheek542 |
B2 |
May 21, 2021, 4:42 a.m. |
OK |
Java 11 |
TESTS |
41 |
218 |
0 |
|
1900 |
116868644 |
aggarwalanshul01 |
B2 |
May 21, 2021, 2:13 a.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116875827 |
tryfg |
B2 |
May 21, 2021, 4:21 a.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116853691 |
Abdallah_Ragab00 |
B2 |
May 20, 2021, 6:55 p.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116851933 |
Adi_7861 |
B2 |
May 20, 2021, 6:32 p.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116849539 |
manan_0104 |
B2 |
May 20, 2021, 6:06 p.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116845616 |
hu_tao |
B2 |
May 20, 2021, 5:36 p.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116841608 |
crazydeveloper |
B2 |
May 20, 2021, 4:33 p.m. |
OK |
Java 8 |
TESTS |
41 |
124 |
0 |
|
1900 |
116855498 |
Adi_7861 |
B2 |
May 20, 2021, 7:25 p.m. |
OK |
Java 8 |
TESTS |
41 |
140 |
0 |
|
1900 |
116854291 |
Dstoical |
B2 |
May 20, 2021, 7:04 p.m. |
OK |
Java 8 |
TESTS |
41 |
140 |
0 |
|
1900 |
116841190 |
Jeg |
B2 |
May 20, 2021, 4:33 p.m. |
OK |
Java 8 |
TESTS |
41 |
202 |
0 |
|
1900 |
116846648 |
hamo510 |
B2 |
May 20, 2021, 5:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
41 |
234 |
0 |
|
1900 |
116858526 |
henrychenOutlook |
B2 |
May 20, 2021, 8:20 p.m. |
OK |
Node.js |
TESTS |
41 |
124 |
6041600 |
|
1900 |
116873500 |
rishabnahar2025 |
B2 |
May 21, 2021, 3:44 a.m. |
OK |
PyPy 2 |
TESTS |
41 |
233 |
14438400 |
|
1900 |
116854835 |
PinkPanicKing |
B2 |
May 20, 2021, 7:13 p.m. |
OK |
PyPy 2 |
TESTS |
41 |
249 |
11366400 |
|
1900 |
116855165 |
abhishekk_7 |
B2 |
May 20, 2021, 7:19 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
124 |
5427200 |
|
1900 |
116870484 |
mkawa2 |
B2 |
May 21, 2021, 2:52 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
124 |
66867200 |
|
1900 |
116871986 |
kirito18086 |
B2 |
May 21, 2021, 3:19 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
140 |
4096000 |
|
1900 |
116853937 |
gourav2001k |
B2 |
May 20, 2021, 6:59 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
140 |
5939200 |
|
1900 |
116855651 |
rivnam |
B2 |
May 20, 2021, 7:27 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
155 |
5734400 |
|
1900 |
116882426 |
uttharapally.chandra |
B2 |
May 21, 2021, 5:51 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
171 |
4198400 |
|
1900 |
116855489 |
rivnam |
B2 |
May 20, 2021, 7:25 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
171 |
6041600 |
|
1900 |
116878594 |
jitendra_joshi3112000 |
B2 |
May 21, 2021, 5 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
186 |
3993600 |
|
1900 |
116878537 |
Half_coder |
B2 |
May 21, 2021, 4:59 a.m. |
OK |
PyPy 3 |
TESTS |
41 |
186 |
4198400 |
|
1900 |
116853759 |
FireBird23 |
B2 |
May 20, 2021, 6:56 p.m. |
OK |
PyPy 3 |
TESTS |
41 |
186 |
5939200 |
|
1900 |
116880525 |
_ArUp_ |
B2 |
May 21, 2021, 5:27 a.m. |
OK |
Python 3 |
TESTS |
41 |
77 |
102400 |
|
1900 |
116841311 |
nabovtl |
B2 |
May 20, 2021, 4:33 p.m. |
OK |
Python 3 |
TESTS |
41 |
77 |
102400 |
|
1900 |
116848774 |
samyaksrivastava9 |
B2 |
May 20, 2021, 5:59 p.m. |
OK |
Python 3 |
TESTS |
41 |
92 |
307200 |
|
1900 |
116874448 |
orazbek |
B2 |
May 21, 2021, 4 a.m. |
OK |
Python 3 |
TESTS |
41 |
155 |
512000 |
|
1900 |
116859996 |
agarus |
B2 |
May 20, 2021, 8:53 p.m. |
OK |
Python 3 |
TESTS |
41 |
202 |
307200 |
|
1900 |
116857959 |
KanishkGoel |
B2 |
May 20, 2021, 8:08 p.m. |
OK |
Python 3 |
TESTS |
41 |
234 |
819200 |
|
1900 |
116857898 |
KanishkGoel |
B2 |
May 20, 2021, 8:07 p.m. |
OK |
Python 3 |
TESTS |
41 |
249 |
819200 |
|
1900 |
116882128 |
Land_oF_cOdErS |
B2 |
May 21, 2021, 5:47 a.m. |
OK |
Python 3 |
TESTS |
41 |
264 |
819200 |
|
1900 |
116869581 |
NS3081992 |
B2 |
May 21, 2021, 2:33 a.m. |
OK |
Python 3 |
TESTS |
41 |
389 |
614400 |
|
1900 |
116881842 |
RR2000 |
B2 |
May 21, 2021, 5:44 a.m. |
OK |
Python 3 |
TESTS |
41 |
592 |
921600 |
|
1900 |
remove filters
Back to search problems