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'Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A ' and 'B '. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets deleted from the string and the remaining parts of the string get concatenated. For example, Zookeeper can use two such operations: AABABBA to AABBA to AAA. Zookeeper wonders what the shortest string he can make is. Can you help him find the length of the shortest string? Each test contains multiple test cases. The first line contains a single integer t (1 <= q t <= q 20000) -- the number of test cases. The description of the test cases follows. Each of the next t lines contains a single test case each, consisting of a non-empty string s : the string that Zookeeper needs to bomb. It is guaranteed that all symbols of s are either 'A ' or 'B '. It is guaranteed that the sum of |s| (length of s ) among all test cases does not exceed 2 cdot 10^5 . For each test case, print a single integer: the length of the shortest string that Zookeeper can make. For the first test case, you can 't make any moves, so the answer is 3 . For the second test case, one optimal sequence of moves is BABA to BA. So, the answer is 2 . For the third test case, one optimal sequence of moves is AABBBABBBB to AABBBABB to AABBBB to ABBB to AB to (empty string). So, the answer is 0 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
95837959 |
impuk |
C |
Oct. 18, 2020, 3:50 a.m. |
OK |
FPC |
TESTS |
31 |
124 |
1433600 |
|
|
95837509 |
ndocx |
C |
Oct. 18, 2020, 3:36 a.m. |
OK |
FPC |
TESTS |
31 |
139 |
1433600 |
|
|
95799190 |
Pandos |
C |
Oct. 17, 2020, 3:11 p.m. |
OK |
GNU C11 |
TESTS |
31 |
93 |
307200 |
|
|
95834154 |
ericoder |
C |
Oct. 18, 2020, 1:48 a.m. |
OK |
GNU C11 |
TESTS |
31 |
108 |
204800 |
|
|
95831211 |
smsylby |
C |
Oct. 17, 2020, 11:19 p.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
0 |
|
|
95836638 |
KagamineRin |
C |
Oct. 18, 2020, 3:12 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
0 |
|
|
95843289 |
yltx |
C |
Oct. 18, 2020, 5:54 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
204800 |
|
|
95836523 |
Lumos_Maxima |
C |
Oct. 18, 2020, 3:09 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
204800 |
|
|
95834160 |
wuruzhao |
C |
Oct. 18, 2020, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
204800 |
|
|
95802727 |
V--T_T--V |
C |
Oct. 17, 2020, 3:22 p.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
204800 |
|
|
95802042 |
htc002 |
C |
Oct. 17, 2020, 3:20 p.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
204800 |
|
|
95837019 |
bfx0215 |
C |
Oct. 18, 2020, 3:23 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
307200 |
|
|
95824097 |
huzzah |
C |
Oct. 17, 2020, 7:41 p.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
307200 |
|
|
95838266 |
S-X-Y |
C |
Oct. 18, 2020, 3:58 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
31 |
409600 |
|
|
95802683 |
xiawubing |
C |
Oct. 17, 2020, 3:21 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
204800 |
|
|
95828172 |
sam721 |
C |
Oct. 17, 2020, 9:18 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
307200 |
|
|
95835293 |
Stucked |
C |
Oct. 18, 2020, 2:28 a.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95830208 |
shouryap |
C |
Oct. 17, 2020, 10:34 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95828090 |
xxzzf5 |
C |
Oct. 17, 2020, 9:15 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95827950 |
FlipTheSwitch |
C |
Oct. 17, 2020, 9:11 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95826526 |
abhijeetsisodiya97 |
C |
Oct. 17, 2020, 8:35 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95841876 |
CheckCheck007 |
C |
Oct. 18, 2020, 5:27 a.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95824257 |
dark_knight_rises_again |
C |
Oct. 17, 2020, 7:45 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95824751 |
sinister_787 |
C |
Oct. 17, 2020, 7:55 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
31 |
512000 |
|
|
95833621 |
TABball |
C |
Oct. 18, 2020, 1:26 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
204800 |
|
|
95814952 |
tokiri |
C |
Oct. 17, 2020, 5:12 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
204800 |
|
|
95842207 |
yuzhechuan |
C |
Oct. 18, 2020, 5:34 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
204800 |
|
|
95832058 |
HCl_10 |
C |
Oct. 18, 2020, 12:07 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
307200 |
|
|
95840527 |
vistoron15 |
C |
Oct. 18, 2020, 5 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95841680 |
KP1010 |
C |
Oct. 18, 2020, 5:23 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95840415 |
JunayedHasan |
C |
Oct. 18, 2020, 4:57 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95840127 |
AMIT9019 |
C |
Oct. 18, 2020, 4:50 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95843450 |
revqx |
C |
Oct. 18, 2020, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95841031 |
BernardHH |
C |
Oct. 18, 2020, 5:10 a.m. |
OK |
GNU C++17 |
TESTS |
31 |
31 |
512000 |
|
|
95812432 |
ItaySherMaN |
C |
Oct. 17, 2020, 4:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
30 |
512000 |
|
|
95836542 |
kailashraturi01 |
C |
Oct. 18, 2020, 3:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
30 |
716800 |
|
|
95823378 |
niggatoxoxo |
C |
Oct. 17, 2020, 7:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
30 |
716800 |
|
|
95830903 |
vjudge5 |
C |
Oct. 17, 2020, 11:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
0 |
|
|
95833305 |
wlzhouzhuan |
C |
Oct. 18, 2020, 1:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
204800 |
|
|
95840318 |
vfpx07 |
C |
Oct. 18, 2020, 4:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
512000 |
|
|
95841461 |
kenechi |
C |
Oct. 18, 2020, 5:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
512000 |
|
|
95841312 |
rniya |
C |
Oct. 18, 2020, 5:16 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
512000 |
|
|
95840001 |
AbhiC7721 |
C |
Oct. 18, 2020, 4:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
512000 |
|
|
95839367 |
tannatsri |
C |
Oct. 18, 2020, 4:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
31 |
512000 |
|
|
95823189 |
a1000 |
C |
Oct. 17, 2020, 7:23 p.m. |
OK |
Java 11 |
TESTS |
31 |
187 |
0 |
|
|
95835057 |
Agnimandur |
C |
Oct. 18, 2020, 2:21 a.m. |
OK |
Java 11 |
TESTS |
31 |
202 |
0 |
|
|
95825369 |
b0bl0blaw |
C |
Oct. 17, 2020, 8:08 p.m. |
OK |
Java 11 |
TESTS |
31 |
202 |
0 |
|
|
95819759 |
shwn_Toss |
C |
Oct. 17, 2020, 6:24 p.m. |
OK |
Java 11 |
TESTS |
31 |
202 |
0 |
|
|
95806300 |
sam_abbas80 |
C |
Oct. 17, 2020, 3:31 p.m. |
OK |
Java 11 |
TESTS |
31 |
218 |
0 |
|
|
95799585 |
Shokersss |
C |
Oct. 17, 2020, 3:12 p.m. |
OK |
Java 11 |
TESTS |
31 |
233 |
0 |
|
|
95822343 |
decoder_1671 |
C |
Oct. 17, 2020, 7:08 p.m. |
OK |
Java 11 |
TESTS |
31 |
234 |
154828800 |
|
|
95802640 |
coderrohan14 |
C |
Oct. 17, 2020, 3:21 p.m. |
OK |
Java 11 |
TESTS |
31 |
249 |
0 |
|
|
95824199 |
tryzen |
C |
Oct. 17, 2020, 7:44 p.m. |
OK |
Java 11 |
TESTS |
31 |
311 |
0 |
|
|
95832338 |
jpark9013 |
C |
Oct. 18, 2020, 12:22 a.m. |
OK |
Java 11 |
TESTS |
31 |
312 |
0 |
|
|
95833298 |
ujjwalavishek |
C |
Oct. 18, 2020, 1:14 a.m. |
OK |
Java 8 |
TESTS |
31 |
109 |
0 |
|
|
95829410 |
csn3rd |
C |
Oct. 17, 2020, 9:59 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95828379 |
kareem3id |
C |
Oct. 17, 2020, 9:24 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95827763 |
MubtasimShahriar |
C |
Oct. 17, 2020, 9:06 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95819958 |
TriumphantEggplant |
C |
Oct. 17, 2020, 6:27 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95814538 |
priyam_anand |
C |
Oct. 17, 2020, 5:06 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95808110 |
overACer |
C |
Oct. 17, 2020, 3:34 p.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95834495 |
aTan |
C |
Oct. 18, 2020, 2:01 a.m. |
OK |
Java 8 |
TESTS |
31 |
124 |
0 |
|
|
95835310 |
ashraybharambe |
C |
Oct. 18, 2020, 2:28 a.m. |
OK |
Java 8 |
TESTS |
31 |
139 |
0 |
|
|
95840379 |
eng_hardik |
C |
Oct. 18, 2020, 4:56 a.m. |
OK |
Java 8 |
TESTS |
31 |
140 |
0 |
|
|
95817175 |
nuralamcse024 |
C |
Oct. 17, 2020, 5:44 p.m. |
OK |
JavaScript |
TESTS |
31 |
140 |
5734400 |
|
|
95812263 |
Tlatoani |
C |
Oct. 17, 2020, 4:39 p.m. |
OK |
Kotlin |
TESTS |
31 |
155 |
0 |
|
|
95803981 |
v4_adi |
C |
Oct. 17, 2020, 3:25 p.m. |
OK |
Kotlin |
TESTS |
31 |
280 |
0 |
|
|
95818323 |
MegaRs |
C |
Oct. 17, 2020, 6:02 p.m. |
OK |
Mono C# |
TESTS |
31 |
171 |
3379200 |
|
|
95816242 |
gurevajv |
C |
Oct. 17, 2020, 5:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
46 |
614400 |
|
|
95806664 |
syynb |
C |
Oct. 17, 2020, 3:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
61 |
4812800 |
|
|
95836452 |
Torehalt |
C |
Oct. 18, 2020, 3:07 a.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
93 |
614400 |
|
|
95822425 |
alex_smarandache15 |
C |
Oct. 17, 2020, 7:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
109 |
614400 |
|
|
95799352 |
Blejac |
C |
Oct. 17, 2020, 3:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
109 |
614400 |
|
|
95835107 |
Educated_GUCCI |
C |
Oct. 18, 2020, 2:22 a.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
124 |
204800 |
|
|
95798938 |
kkismatov2002 |
C |
Oct. 17, 2020, 3:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
124 |
614400 |
|
|
95805268 |
peachy |
C |
Oct. 17, 2020, 3:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
124 |
3788800 |
|
|
95829254 |
hruif |
C |
Oct. 17, 2020, 9:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
187 |
204800 |
|
|
95814224 |
D9RS |
C |
Oct. 17, 2020, 5:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
202 |
614400 |
|
|
95835474 |
shahincsejnu |
C |
Oct. 18, 2020, 2:35 a.m. |
OK |
.NET Core C# |
TESTS |
31 |
202 |
2560000 |
|
|
95825734 |
SK_EON |
C |
Oct. 17, 2020, 8:16 p.m. |
OK |
PyPy 2 |
TESTS |
31 |
202 |
11059200 |
|
|
95832454 |
june_waves |
C |
Oct. 18, 2020, 12:27 a.m. |
OK |
PyPy 3 |
TESTS |
31 |
155 |
4505600 |
|
|
95821975 |
manhar |
C |
Oct. 17, 2020, 7:01 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
155 |
7270400 |
|
|
95814313 |
june_waves |
C |
Oct. 17, 2020, 5:03 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
171 |
6144000 |
|
|
95802576 |
xiddekate |
C |
Oct. 17, 2020, 3:21 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
186 |
2867200 |
|
|
95832566 |
june_waves |
C |
Oct. 18, 2020, 12:34 a.m. |
OK |
PyPy 3 |
TESTS |
31 |
186 |
2969600 |
|
|
95819123 |
EpicChadGamer |
C |
Oct. 17, 2020, 6:14 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
186 |
5017600 |
|
|
95811345 |
upadhyay.aaditya2001 |
C |
Oct. 17, 2020, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
186 |
12083200 |
|
|
95832523 |
june_waves |
C |
Oct. 18, 2020, 12:31 a.m. |
OK |
PyPy 3 |
TESTS |
31 |
187 |
5734400 |
|
|
95816251 |
kaleabasfaw2010 |
C |
Oct. 17, 2020, 5:30 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
187 |
13209600 |
|
|
95826267 |
Bovniova |
C |
Oct. 17, 2020, 8:29 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
202 |
7782400 |
|
|
95817469 |
ComptineDunAutreEte |
C |
Oct. 17, 2020, 5:48 p.m. |
OK |
Python 2 |
TESTS |
31 |
233 |
2355200 |
|
|
95805993 |
Cirect |
C |
Oct. 17, 2020, 3:30 p.m. |
OK |
Python 2 |
TESTS |
31 |
249 |
5529600 |
|
|
95838925 |
seg__fault |
C |
Oct. 18, 2020, 4:17 a.m. |
OK |
Python 3 |
TESTS |
31 |
170 |
921600 |
|
|
95803804 |
bitshifter42 |
C |
Oct. 17, 2020, 3:25 p.m. |
OK |
Python 3 |
TESTS |
31 |
187 |
819200 |
|
|
95818978 |
Dineshlimbu |
C |
Oct. 17, 2020, 6:12 p.m. |
OK |
Python 3 |
TESTS |
31 |
202 |
1843200 |
|
|
95829522 |
kihyo |
C |
Oct. 17, 2020, 10:04 p.m. |
OK |
Python 3 |
TESTS |
31 |
249 |
1126400 |
|
|
95832390 |
Madhuvanthi_srikanth |
C |
Oct. 18, 2020, 12:25 a.m. |
OK |
Python 3 |
TESTS |
31 |
264 |
819200 |
|
|
95804483 |
ixuan |
C |
Oct. 17, 2020, 3:26 p.m. |
OK |
Python 3 |
TESTS |
31 |
264 |
1126400 |
|
|
95819582 |
Rinata100 |
C |
Oct. 17, 2020, 6:21 p.m. |
OK |
Python 3 |
TESTS |
31 |
265 |
819200 |
|
|
95815313 |
nobita09 |
C |
Oct. 17, 2020, 5:17 p.m. |
OK |
Python 3 |
TESTS |
31 |
265 |
819200 |
|
|
95814147 |
Saicharn_nr |
C |
Oct. 17, 2020, 5:01 p.m. |
OK |
Python 3 |
TESTS |
31 |
265 |
819200 |
|
|
95810856 |
t_error |
C |
Oct. 17, 2020, 4:27 p.m. |
OK |
Python 3 |
TESTS |
31 |
265 |
819200 |
|
|
95800555 |
masa0216masa0216masa0216 |
C |
Oct. 17, 2020, 3:15 p.m. |
OK |
Ruby |
TESTS |
31 |
608 |
16793600 |
|
|
95821388 |
xodeChemist |
C |
Oct. 17, 2020, 6:50 p.m. |
OK |
Ruby |
TESTS |
31 |
779 |
16384000 |
|
|
95810066 |
arturas |
C |
Oct. 17, 2020, 4:23 p.m. |
OK |
Rust |
TESTS |
31 |
46 |
2355200 |
|
|
95837371 |
crazyboycjr0.1 |
C |
Oct. 18, 2020, 3:33 a.m. |
OK |
Rust |
TESTS |
31 |
234 |
512000 |
|
|
95830226 |
Kaa |
C |
Oct. 17, 2020, 10:35 p.m. |
OK |
Rust |
TESTS |
31 |
280 |
1945600 |
|
|
remove filters
Back to search problems