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'Ashish has a binary string s of length n that he wants to sort in non-decreasing order. He can perform the following operation: Find the minimum number of operations required to sort the string in non-decreasing order. It can be proven that it is always possible to sort the given binary string in at most n operations. The first line contains a single integer t (1 <= t <= 1000) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n (1 <= n <= 1000) -- the length of the binary string s . The second line of each test case contains a binary string s of length n containing only 0 s and 1 s. It is guaranteed that the sum of n over all test cases does not exceed 1000 . For each test case output the following: In the first test case, the binary string is already sorted in non-decreasing order. In the second test case, we can perform the following operation: underline{1} 0 underline{1} underline{0} underline{0} rightarrow underline{0} 0 underline{0} underline{1} underline{1} In the third test case, we can perform the following operation: 0 0 underline{1} 0 underline{0} underline{0} rightarrow 0 0 underline{0} 0 underline{0} underline{1} '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
135164830 |
lansar |
B |
Nov. 12, 2021, 4:22 p.m. |
OK |
GNU C11 |
TESTS |
35 |
15 |
3686400 |
|
1000 |
135175900 |
Erd0s |
B |
Nov. 12, 2021, 5:17 p.m. |
OK |
GNU C11 |
TESTS |
35 |
15 |
3686400 |
|
1000 |
135212749 |
Tanish-kumar |
B |
Nov. 13, 2021, 3:55 a.m. |
OK |
GNU C11 |
TESTS |
35 |
15 |
3686400 |
|
1000 |
135192297 |
murali_33 |
B |
Nov. 12, 2021, 8 p.m. |
OK |
GNU C11 |
TESTS |
35 |
15 |
4710400 |
|
1000 |
135172516 |
julic20s |
B |
Nov. 12, 2021, 4:58 p.m. |
OK |
GNU C11 |
TESTS |
35 |
30 |
3686400 |
|
1000 |
135200149 |
PIERRE_EMAD |
B |
Nov. 12, 2021, 10:42 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
0 |
1228800 |
|
1000 |
135174571 |
yuminghang |
B |
Nov. 12, 2021, 5:08 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135207351 |
vjudge5 |
B |
Nov. 13, 2021, 2:18 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135205990 |
ftyghome |
B |
Nov. 13, 2021, 1:48 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135203450 |
srt20050822 |
B |
Nov. 13, 2021, 12:38 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135202636 |
dothanhtrung190906 |
B |
Nov. 13, 2021, 12:10 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135197255 |
satyapsr13 |
B |
Nov. 12, 2021, 9:27 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135188167 |
dingdingding |
B |
Nov. 12, 2021, 7:04 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135215311 |
THEGAI |
B |
Nov. 13, 2021, 4:39 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135209581 |
_Guoxin |
B |
Nov. 13, 2021, 2:58 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135210171 |
rm17 |
B |
Nov. 13, 2021, 3:09 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
0 |
1228800 |
|
1000 |
135214855 |
Y12309 |
B |
Nov. 13, 2021, 4:31 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135214092 |
HuXianqing |
B |
Nov. 13, 2021, 4:18 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135213293 |
ducanh123 |
B |
Nov. 13, 2021, 4:04 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135211255 |
Nuist_wzy |
B |
Nov. 13, 2021, 3:29 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135210369 |
tyx_cnyali |
B |
Nov. 13, 2021, 3:12 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135216089 |
shaosy |
B |
Nov. 13, 2021, 4:51 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135220945 |
huwenbo |
B |
Nov. 13, 2021, 5:52 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135219536 |
tremble |
B |
Nov. 13, 2021, 5:35 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135217826 |
Ashuatp |
B |
Nov. 13, 2021, 5:15 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
15 |
1024000 |
|
1000 |
135207822 |
zykkezi |
B |
Nov. 13, 2021, 2:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
0 |
1228800 |
|
1000 |
135208205 |
no_words_to_sky |
B |
Nov. 13, 2021, 2:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135202732 |
w23c3c3 |
B |
Nov. 13, 2021, 12:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135218642 |
akshat9512 |
B |
Nov. 13, 2021, 5:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135219954 |
deepak0byte |
B |
Nov. 13, 2021, 5:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135219581 |
khan_talha |
B |
Nov. 13, 2021, 5:36 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135219186 |
sunny77 |
B |
Nov. 13, 2021, 5:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135218337 |
prithvijitbasak |
B |
Nov. 13, 2021, 5:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135217733 |
aryan57 |
B |
Nov. 13, 2021, 5:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135217235 |
aTSL |
B |
Nov. 13, 2021, 5:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135177280 |
srejanbera |
B |
Nov. 12, 2021, 5:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
0 |
1331200 |
|
1000 |
135218579 |
Joseph1314 |
B |
Nov. 13, 2021, 5:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135218028 |
KKRpro |
B |
Nov. 13, 2021, 5:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135217298 |
benzyl |
B |
Nov. 13, 2021, 5:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135215151 |
Froshine |
B |
Nov. 13, 2021, 4:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135214926 |
bkifhr8 |
B |
Nov. 13, 2021, 4:32 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135219396 |
ashina_issin |
B |
Nov. 13, 2021, 5:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135219797 |
deucalion |
B |
Nov. 13, 2021, 5:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135220407 |
mdstoy |
B |
Nov. 13, 2021, 5:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135218931 |
zxzxzxd |
B |
Nov. 13, 2021, 5:28 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
15 |
1228800 |
|
1000 |
135164859 |
Fiooora |
B |
Nov. 12, 2021, 4:22 p.m. |
OK |
Go |
TESTS |
35 |
46 |
8192000 |
|
1000 |
135163481 |
codelegend |
B |
Nov. 12, 2021, 4:19 p.m. |
OK |
Haskell |
TESTS |
35 |
30 |
11161600 |
|
1000 |
135200840 |
Toinfinity |
B |
Nov. 12, 2021, 11:07 p.m. |
OK |
Java 11 |
TESTS |
35 |
155 |
24473600 |
|
1000 |
135190798 |
Debojit219 |
B |
Nov. 12, 2021, 7:39 p.m. |
OK |
Java 11 |
TESTS |
35 |
186 |
24780800 |
|
1000 |
135217665 |
BiggEr. |
B |
Nov. 13, 2021, 5:13 a.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
24678400 |
|
1000 |
135176350 |
bobib |
B |
Nov. 12, 2021, 5:20 p.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
24780800 |
|
1000 |
135179165 |
Abhishek_patel_ |
B |
Nov. 12, 2021, 5:41 p.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
24780800 |
|
1000 |
135188280 |
MubtasimShahriar |
B |
Nov. 12, 2021, 7:06 p.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
24985600 |
|
1000 |
135214848 |
himanshu_0624 |
B |
Nov. 13, 2021, 4:31 a.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
25190400 |
|
1000 |
135219594 |
shivam29702 |
B |
Nov. 13, 2021, 5:36 a.m. |
OK |
Java 11 |
TESTS |
35 |
187 |
36044800 |
|
1000 |
135174674 |
ddwuya |
B |
Nov. 12, 2021, 5:09 p.m. |
OK |
Java 11 |
TESTS |
35 |
202 |
24678400 |
|
1000 |
135166100 |
humblefool6996 |
B |
Nov. 12, 2021, 4:25 p.m. |
OK |
Java 11 |
TESTS |
35 |
202 |
24678400 |
|
1000 |
135186429 |
RonWonWon |
B |
Nov. 12, 2021, 6:45 p.m. |
OK |
Java 8 |
TESTS |
35 |
93 |
18739200 |
|
1000 |
135184013 |
NerfThis |
B |
Nov. 12, 2021, 6:21 p.m. |
OK |
Java 8 |
TESTS |
35 |
93 |
18841600 |
|
1000 |
135167881 |
TopSafder |
B |
Nov. 12, 2021, 4:29 p.m. |
OK |
Java 8 |
TESTS |
35 |
109 |
18841600 |
|
1000 |
135165867 |
less_ordinary |
B |
Nov. 12, 2021, 4:24 p.m. |
OK |
Java 8 |
TESTS |
35 |
109 |
18841600 |
|
1000 |
135206867 |
Piyushnagpal80 |
B |
Nov. 13, 2021, 2:08 a.m. |
OK |
Java 8 |
TESTS |
35 |
109 |
19046400 |
|
1000 |
135203524 |
coolManit |
B |
Nov. 13, 2021, 12:40 a.m. |
OK |
Java 8 |
TESTS |
35 |
124 |
18841600 |
|
1000 |
135174950 |
Depool |
B |
Nov. 12, 2021, 5:11 p.m. |
OK |
Java 8 |
TESTS |
35 |
124 |
18841600 |
|
1000 |
135206846 |
saltedfish54250 |
B |
Nov. 13, 2021, 2:07 a.m. |
OK |
Java 8 |
TESTS |
35 |
124 |
19046400 |
|
1000 |
135214824 |
rakshith572 |
B |
Nov. 13, 2021, 4:31 a.m. |
OK |
Java 8 |
TESTS |
35 |
124 |
19046400 |
|
1000 |
135166411 |
syedmizbah |
B |
Nov. 12, 2021, 4:26 p.m. |
OK |
Java 8 |
TESTS |
35 |
124 |
19148800 |
|
1000 |
135162977 |
gleb32 |
B |
Nov. 12, 2021, 4:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135212358 |
thonns178 |
B |
Nov. 13, 2021, 3:49 a.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135200083 |
chika10 |
B |
Nov. 12, 2021, 10:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135176073 |
kaskelot |
B |
Nov. 12, 2021, 5:18 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135173099 |
Tangerine |
B |
Nov. 12, 2021, 5:01 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
1126400 |
|
1000 |
135208943 |
bkifhr7 |
B |
Nov. 13, 2021, 2:47 a.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
15 |
2150400 |
|
1000 |
135175888 |
kaskelot |
B |
Nov. 12, 2021, 5:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
30 |
1126400 |
|
1000 |
135212847 |
ispoon |
B |
Nov. 13, 2021, 3:57 a.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
30 |
1126400 |
|
1000 |
135173606 |
czm233 |
B |
Nov. 12, 2021, 5:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
35 |
31 |
1126400 |
|
1000 |
135185950 |
avtoruxadze |
B |
Nov. 12, 2021, 6:40 p.m. |
OK |
.NET Core C# |
TESTS |
35 |
77 |
9011200 |
|
1000 |
135211407 |
chinesedfan |
B |
Nov. 13, 2021, 3:32 a.m. |
OK |
Node.js |
TESTS |
35 |
62 |
9932800 |
|
1000 |
135201640 |
s3vin |
B |
Nov. 12, 2021, 11:35 p.m. |
OK |
Perl |
TESTS |
35 |
31 |
2355200 |
|
1000 |
135172697 |
1_2_3_4_5_9 |
B |
Nov. 12, 2021, 4:59 p.m. |
OK |
PyPy 2 |
TESTS |
35 |
77 |
20992000 |
|
1000 |
135186602 |
Marshmello |
B |
Nov. 12, 2021, 6:47 p.m. |
OK |
PyPy 2 |
TESTS |
35 |
93 |
20787200 |
|
1000 |
135197178 |
wolfram_ |
B |
Nov. 12, 2021, 9:26 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
77 |
17715200 |
|
1000 |
135195815 |
whatshisbucket |
B |
Nov. 12, 2021, 8:58 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
77 |
17715200 |
|
1000 |
135180411 |
anubhav100rao |
B |
Nov. 12, 2021, 5:50 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
77 |
18944000 |
|
1000 |
135216163 |
rajbit |
B |
Nov. 13, 2021, 4:52 a.m. |
OK |
PyPy 3 |
TESTS |
35 |
77 |
19558400 |
|
1000 |
135164071 |
shiraz_30 |
B |
Nov. 12, 2021, 4:20 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
77 |
19865600 |
|
1000 |
135172833 |
harshitkumargupta |
B |
Nov. 12, 2021, 4:59 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
92 |
19148800 |
|
1000 |
135172361 |
akshitm16 |
B |
Nov. 12, 2021, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
93 |
17715200 |
|
1000 |
135163650 |
Hot_Potato |
B |
Nov. 12, 2021, 4:19 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
93 |
17715200 |
|
1000 |
135213655 |
nicku123 |
B |
Nov. 13, 2021, 4:10 a.m. |
OK |
PyPy 3 |
TESTS |
35 |
93 |
18022400 |
|
1000 |
135184317 |
orz_liuwei |
B |
Nov. 12, 2021, 6:24 p.m. |
OK |
PyPy 3 |
TESTS |
35 |
93 |
19046400 |
|
1000 |
135174802 |
guineapig |
B |
Nov. 12, 2021, 5:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
62 |
28979200 |
|
1000 |
135164022 |
oV01Do |
B |
Nov. 12, 2021, 4:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
30208000 |
|
1000 |
135202244 |
raspi |
B |
Nov. 12, 2021, 11:57 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
30412800 |
|
1000 |
135202188 |
raspi |
B |
Nov. 12, 2021, 11:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
30515200 |
|
1000 |
135221505 |
jainmilind |
B |
Nov. 13, 2021, 5:57 a.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31027200 |
|
1000 |
135208528 |
rutz12 |
B |
Nov. 13, 2021, 2:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31436800 |
|
1000 |
135205661 |
_Surrender_ |
B |
Nov. 13, 2021, 1:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31436800 |
|
1000 |
135167652 |
CyberSick |
B |
Nov. 12, 2021, 4:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31846400 |
|
1000 |
135215951 |
aayush0501200 |
B |
Nov. 13, 2021, 4:49 a.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31948800 |
|
1000 |
135177930 |
jainmilind |
B |
Nov. 12, 2021, 5:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
35 |
77 |
31948800 |
|
1000 |
135213090 |
yashM. |
B |
Nov. 13, 2021, 4:01 a.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135212790 |
codheck_0 |
B |
Nov. 13, 2021, 3:56 a.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135203534 |
Bilguunzen |
B |
Nov. 13, 2021, 12:41 a.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135189493 |
adityamishra0007 |
B |
Nov. 12, 2021, 7:21 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135188762 |
neel0086 |
B |
Nov. 12, 2021, 7:11 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135180266 |
kalandar |
B |
Nov. 12, 2021, 5:49 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135179734 |
ritesh_43 |
B |
Nov. 12, 2021, 5:45 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135174901 |
NAT_Hung |
B |
Nov. 12, 2021, 5:10 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135169569 |
MohammedAlewi |
B |
Nov. 12, 2021, 4:32 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135164533 |
mihir111p |
B |
Nov. 12, 2021, 4:21 p.m. |
OK |
Python 3 |
TESTS |
35 |
46 |
4505600 |
|
1000 |
135202423 |
Spheniscine |
B |
Nov. 13, 2021, 12:03 a.m. |
OK |
Rust |
TESTS |
35 |
30 |
1331200 |
|
1000 |
remove filters
Back to search problems