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'You have a stripe of checkered paper of length n . Each cell is either white or black. What is the minimum number of cells that must be recolored from white to black in order to have a segment of k consecutive black cells on the stripe? If the input data is such that a segment of k consecutive black cells already exists, then print 0. The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Next, descriptions of t test cases follow. The first line of the input contains two integers n and k ( 1 <= k <= n <= 2 cdot10^5 ). The second line consists of the letters 'W ' (white) and 'B ' (black). The line length is n . It is guaranteed that the sum of values n does not exceed 2 cdot10^5 . For each of t test cases print an integer -- the minimum number of cells that need to be repainted from white to black in order to have a segment of k consecutive black cells. In the first test case, s ="BBWBW" and k=3 . It is enough to recolor s_3 and get s ="BBBBW". This string contains a segment of length k=3 consisting of the letters 'B '. In the second test case of the example s ="BBWBW" and k=5 . It is enough to recolor s_3 and s_5 and get s ="BBBBB". This string contains a segment of length k=5 consisting of the letters 'B '. In the third test case of the example s ="BBWBW" and k=1 . The string s already contains a segment of length k=1 consisting of the letters 'B '. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
159936769 |
Hieungan |
D |
June 8, 2022, 12:31 p.m. |
OK |
FPC |
TESTS |
18 |
46 |
1331200 |
|
1000 |
159905165 |
Abhishek_Tewatia |
D |
June 8, 2022, 6:21 a.m. |
OK |
GNU C11 |
TESTS |
18 |
46 |
204800 |
|
1000 |
159940272 |
WinterScroll424 |
D |
June 8, 2022, 1:11 p.m. |
OK |
GNU C11 |
TESTS |
18 |
46 |
204800 |
|
1000 |
159979128 |
xueyan |
D |
June 9, 2022, 1:25 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159910696 |
momomodalao |
D |
June 8, 2022, 7:23 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159914651 |
Parvjain12 |
D |
June 8, 2022, 8:24 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159965787 |
Prashant30123 |
D |
June 8, 2022, 6:36 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159959101 |
cout_wolf |
D |
June 8, 2022, 5:08 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159953960 |
jhachirag7 |
D |
June 8, 2022, 3:59 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159947257 |
Yujin01 |
D |
June 8, 2022, 2:31 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159933965 |
M0hamed_Fathi |
D |
June 8, 2022, 11:59 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159980662 |
yushiuan |
D |
June 9, 2022, 2:20 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159976405 |
songqian |
D |
June 8, 2022, 11:18 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159954112 |
DiptoArchyes07 |
D |
June 8, 2022, 4:01 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
0 |
|
1000 |
159931416 |
Blueberry_1 |
D |
June 8, 2022, 11:32 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159923185 |
Monarchuwu |
D |
June 8, 2022, 9:56 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159944702 |
kobeforces |
D |
June 8, 2022, 2:01 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159948288 |
_Dio |
D |
June 8, 2022, 2:45 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
204800 |
|
1000 |
159926605 |
wscj |
D |
June 8, 2022, 10:37 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
307200 |
|
1000 |
159981446 |
Hard_2_FaceReality |
D |
June 9, 2022, 2:46 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159977245 |
helmor |
D |
June 9, 2022, 12:04 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159975809 |
jxu7 |
D |
June 8, 2022, 10:51 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159988960 |
kg151 |
D |
June 9, 2022, 5:44 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
512000 |
|
1000 |
159946716 |
tired_sloth |
D |
June 8, 2022, 2:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
102400 |
|
1000 |
159971071 |
kumarsachinnnn299 |
D |
June 8, 2022, 8:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159989433 |
OTTFF |
D |
June 9, 2022, 5:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159906535 |
Sakib62 |
D |
June 8, 2022, 6:36 a.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159954786 |
ImHubery |
D |
June 8, 2022, 4:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159943355 |
BhavyaSolanki_9 |
D |
June 8, 2022, 1:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159963131 |
keeping_running |
D |
June 8, 2022, 5:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159974868 |
RoWan_Hamada |
D |
June 8, 2022, 10:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159954837 |
ganapati_biswas |
D |
June 8, 2022, 4:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159963044 |
amans07 |
D |
June 8, 2022, 5:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159955289 |
sd_3009 |
D |
June 8, 2022, 4:17 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
0 |
512000 |
|
1000 |
159954522 |
Me_Tal |
D |
June 8, 2022, 4:07 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159954189 |
Me_Tal |
D |
June 8, 2022, 4:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159910765 |
satyam_abk |
D |
June 8, 2022, 7:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
204800 |
|
1000 |
159983868 |
huomark1001 |
D |
June 9, 2022, 3:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159989208 |
sourav_patwal |
D |
June 9, 2022, 5:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159983945 |
Mushfiq_Talha |
D |
June 9, 2022, 3:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159980475 |
jasonray0328 |
D |
June 9, 2022, 2:13 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159978266 |
BurningFalls |
D |
June 9, 2022, 12:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159977113 |
Emperor_Nazer |
D |
June 8, 2022, 11:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
15 |
512000 |
|
1000 |
159915937 |
n1cknamezz |
D |
June 8, 2022, 8:38 a.m. |
OK |
Go |
TESTS |
18 |
31 |
1638400 |
|
1000 |
159989330 |
vijender_8601 |
D |
June 9, 2022, 5:50 a.m. |
OK |
Java 11 |
TESTS |
18 |
171 |
0 |
|
1000 |
159985881 |
eshan18.09 |
D |
June 9, 2022, 4:44 a.m. |
OK |
Java 11 |
TESTS |
18 |
186 |
0 |
|
1000 |
159961403 |
rickyy |
D |
June 8, 2022, 5:37 p.m. |
OK |
Java 11 |
TESTS |
18 |
186 |
0 |
|
1000 |
159906195 |
Darcy__ |
D |
June 8, 2022, 6:33 a.m. |
OK |
Java 11 |
TESTS |
18 |
187 |
0 |
|
1000 |
159966957 |
nawaz_habib |
D |
June 8, 2022, 6:54 p.m. |
OK |
Java 11 |
TESTS |
18 |
187 |
0 |
|
1000 |
159955749 |
vamshisamineni3 |
D |
June 8, 2022, 4:24 p.m. |
OK |
Java 11 |
TESTS |
18 |
187 |
0 |
|
1000 |
159940460 |
Aman_dixit |
D |
June 8, 2022, 1:13 p.m. |
OK |
Java 11 |
TESTS |
18 |
187 |
15052800 |
|
1000 |
159930923 |
vinam1 |
D |
June 8, 2022, 11:27 a.m. |
OK |
Java 11 |
TESTS |
18 |
202 |
0 |
|
1000 |
159912423 |
_alpaca |
D |
June 8, 2022, 7:47 a.m. |
OK |
Java 11 |
TESTS |
18 |
202 |
0 |
|
1000 |
159921875 |
vishrut_goti6231 |
D |
June 8, 2022, 9:42 a.m. |
OK |
Java 11 |
TESTS |
18 |
218 |
0 |
|
1000 |
159920776 |
kocko |
D |
June 8, 2022, 9:30 a.m. |
OK |
Java 8 |
TESTS |
18 |
93 |
0 |
|
1000 |
159974249 |
ahmedtawfik |
D |
June 8, 2022, 9:47 p.m. |
OK |
Java 8 |
TESTS |
18 |
109 |
0 |
|
1000 |
159932576 |
moyan_01 |
D |
June 8, 2022, 11:45 a.m. |
OK |
Java 8 |
TESTS |
18 |
109 |
0 |
|
1000 |
159942510 |
abhinavTalesra |
D |
June 8, 2022, 1:36 p.m. |
OK |
Java 8 |
TESTS |
18 |
124 |
4608000 |
|
1000 |
159908534 |
P_Key26dec |
D |
June 8, 2022, 6:58 a.m. |
OK |
Java 8 |
TESTS |
18 |
124 |
17817600 |
|
1000 |
159944258 |
imsd_14 |
D |
June 8, 2022, 1:56 p.m. |
OK |
Java 8 |
TESTS |
18 |
155 |
0 |
|
1000 |
159935583 |
fengyu1 |
D |
June 8, 2022, 12:18 p.m. |
OK |
Java 8 |
TESTS |
18 |
156 |
0 |
|
1000 |
159982309 |
nithin_bharathi |
D |
June 9, 2022, 3:11 a.m. |
OK |
Java 8 |
TESTS |
18 |
171 |
0 |
|
1000 |
159977043 |
This_is_Rish |
D |
June 8, 2022, 11:54 p.m. |
OK |
Java 8 |
TESTS |
18 |
171 |
0 |
|
1000 |
159957020 |
SainiAayush |
D |
June 8, 2022, 4:41 p.m. |
OK |
Java 8 |
TESTS |
18 |
186 |
0 |
|
1000 |
159955861 |
nitish420 |
D |
June 8, 2022, 4:26 p.m. |
OK |
Kotlin 1.6 |
TESTS |
18 |
280 |
0 |
|
1000 |
159982218 |
Abhayngu |
D |
June 9, 2022, 3:09 a.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
61 |
614400 |
|
1000 |
159952649 |
OptimuS99 |
D |
June 8, 2022, 3:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
108 |
204800 |
|
1000 |
159907646 |
yoralbayev |
D |
June 8, 2022, 6:48 a.m. |
OK |
PHP |
TESTS |
18 |
124 |
14745600 |
|
1000 |
159910684 |
xuhao95 |
D |
June 8, 2022, 7:23 a.m. |
OK |
PyPy 3 |
TESTS |
18 |
139 |
5222400 |
|
1000 |
159973921 |
dev8ag |
D |
June 8, 2022, 9:35 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
155 |
5120000 |
|
1000 |
159937589 |
YMSeah |
D |
June 8, 2022, 12:41 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
155 |
6348800 |
|
1000 |
159921203 |
Apoorv_Rathore |
D |
June 8, 2022, 9:34 a.m. |
OK |
PyPy 3 |
TESTS |
18 |
155 |
7680000 |
|
1000 |
159922665 |
sagamantus |
D |
June 8, 2022, 9:51 a.m. |
OK |
PyPy 3 |
TESTS |
18 |
170 |
6963200 |
|
1000 |
159948209 |
tcltk |
D |
June 8, 2022, 2:44 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
249 |
8908800 |
|
1000 |
159910229 |
MohammadsadraSedighin |
D |
June 8, 2022, 7:18 a.m. |
OK |
PyPy 3 |
TESTS |
18 |
343 |
6656000 |
|
1000 |
159951317 |
iss2009 |
D |
June 8, 2022, 3:26 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
358 |
8908800 |
|
1000 |
159964360 |
ShrijitShaswat |
D |
June 8, 2022, 6:16 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
374 |
7270400 |
|
1000 |
159910249 |
Tanish08 |
D |
June 8, 2022, 7:18 a.m. |
OK |
PyPy 3 |
TESTS |
18 |
374 |
9011200 |
|
1000 |
159963655 |
samchen123 |
D |
June 8, 2022, 6:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
108 |
7680000 |
|
1000 |
159914963 |
mayank35 |
D |
June 8, 2022, 8:28 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
124 |
6348800 |
|
1000 |
159930554 |
andreyk444 |
D |
June 8, 2022, 11:23 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
124 |
9523200 |
|
1000 |
159971172 |
MashaM |
D |
June 8, 2022, 8:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
124 |
9830400 |
|
1000 |
159929516 |
piSquared |
D |
June 8, 2022, 11:11 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
124 |
9932800 |
|
1000 |
159916898 |
aman404found |
D |
June 8, 2022, 8:49 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
139 |
9728000 |
|
1000 |
159971531 |
AngelAS |
D |
June 8, 2022, 8:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
140 |
10035200 |
|
1000 |
159917583 |
radoan.sharkar.richi |
D |
June 8, 2022, 8:55 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
155 |
9625600 |
|
1000 |
159981638 |
MistaAsh |
D |
June 9, 2022, 2:52 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
155 |
9728000 |
|
1000 |
159934862 |
crapcode |
D |
June 8, 2022, 12:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
155 |
10547200 |
|
1000 |
159945185 |
5ch3ma |
D |
June 8, 2022, 2:06 p.m. |
OK |
Python 3 |
TESTS |
18 |
78 |
2560000 |
|
1000 |
159982157 |
rostoki |
D |
June 9, 2022, 3:07 a.m. |
OK |
Python 3 |
TESTS |
18 |
124 |
1331200 |
|
1000 |
159918250 |
H_Raja |
D |
June 8, 2022, 9:03 a.m. |
OK |
Python 3 |
TESTS |
18 |
139 |
7372800 |
|
1000 |
159967847 |
abhipraay |
D |
June 8, 2022, 7:09 p.m. |
OK |
Python 3 |
TESTS |
18 |
140 |
307200 |
|
1000 |
159960913 |
super_puper_mega_star |
D |
June 8, 2022, 5:30 p.m. |
OK |
Python 3 |
TESTS |
18 |
155 |
307200 |
|
1000 |
159909081 |
Ayush_ag |
D |
June 8, 2022, 7:04 a.m. |
OK |
Python 3 |
TESTS |
18 |
155 |
307200 |
|
1000 |
159944079 |
zemigsan |
D |
June 8, 2022, 1:54 p.m. |
OK |
Python 3 |
TESTS |
18 |
156 |
307200 |
|
1000 |
159963078 |
zaoder |
D |
June 8, 2022, 5:58 p.m. |
OK |
Python 3 |
TESTS |
18 |
170 |
0 |
|
1000 |
159970785 |
Collabro |
D |
June 8, 2022, 8:08 p.m. |
OK |
Python 3 |
TESTS |
18 |
171 |
307200 |
|
1000 |
159927168 |
sixthcore |
D |
June 8, 2022, 10:44 a.m. |
OK |
Python 3 |
TESTS |
18 |
171 |
2048000 |
|
1000 |
159948828 |
isaiah_hex |
D |
June 8, 2022, 2:52 p.m. |
OK |
Rust 2021 |
TESTS |
18 |
140 |
1024000 |
|
1000 |
remove filters
Back to search problems