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 Winter holiday will be here soon. Mr. Chanek wants to decorate his house's wall with ornaments. The wall can be represented as a binary string a of length n . His favorite nephew has another binary string b of length m ( m <= q n ). Mr. Chanek's nephew loves the non-negative integer k . His nephew wants exactly k occurrences of b as substrings in a . However, Mr. Chanek does not know the value of k . So, for each k ( 0 <= q k <= q n - m + 1 ), find the minimum number of elements in a that have to be changed such that there are exactly k occurrences of b in a . A string s occurs exactly k times in t if there are exactly k different pairs (p,q) such that we can obtain s by deleting p characters from the beginning and q characters from the end of t . The first line contains two integers n and m ( 1 <= q m <= q n <= q 500 ) -- size of the binary string a and b respectively. The second line contains a binary string a of length n . The third line contains a binary string b of length m . Output n - m + 2 integers -- the (k+1) -th integer denotes the minimal number of elements in a that have to be changed so there are exactly k occurrences of b as a substring in a . For k = 0 , to make the string a have no occurrence of 101, you can do one character change as follows. 100101011 rightarrow 100100011 For k = 1 , you can also change a single character. 100101011 rightarrow 100001011 For k = 2 , no changes are needed. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
130578620 |
xuanquang1999 |
H |
Oct. 2, 2021, 3:39 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
46 |
6144000 |
|
|
130585677 |
HwSh |
H |
Oct. 2, 2021, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
46 |
6246400 |
|
|
130581105 |
chenjb shb123 FrostStar |
H |
Oct. 2, 2021, 4:07 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
62 |
5836800 |
|
|
130581243 |
nwi |
H |
Oct. 2, 2021, 4:08 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
124 |
5836800 |
|
|
130577672 |
AwakeAnay 100gods jenishmonpara |
H |
Oct. 2, 2021, 3:28 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
156 |
7987200 |
|
|
130594581 |
shashwat259 |
H |
Oct. 2, 2021, 7:17 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
264 |
507699200 |
|
|
130573395 |
arjo aditya.verma amul_agrawal |
H |
Oct. 2, 2021, 2:44 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
296 |
510771200 |
|
|
130583120 |
Melania ttee |
H |
Oct. 2, 2021, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
296 |
519884800 |
|
|
130596607 |
cookiedoth rqi Egor.Lifar |
H |
Oct. 2, 2021, 7:58 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
420 |
266444800 |
|
|
130593446 |
Ertugrul28 |
H |
Oct. 2, 2021, 6:56 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
451 |
519884800 |
|
|
130583522 |
rheallyc cxaphoenix |
H |
Oct. 2, 2021, 4:37 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
46 |
6041600 |
|
|
130590575 |
xiaoxiaobaozi |
H |
Oct. 2, 2021, 6:13 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
62 |
4608000 |
|
|
130575665 |
gisp_zjz |
H |
Oct. 2, 2021, 3:06 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
62 |
5836800 |
|
|
130579590 |
wiwitrifai Luqman |
H |
Oct. 2, 2021, 3:49 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
93 |
5836800 |
|
|
130583408 |
old_player |
H |
Oct. 2, 2021, 4:35 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
93 |
346316800 |
|
|
130580494 |
xb0nS |
H |
Oct. 2, 2021, 4 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
109 |
5836800 |
|
|
130582352 |
Bugman |
H |
Oct. 2, 2021, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
124 |
4505600 |
|
|
130574640 |
Lemonade255 dtc03012 pser |
H |
Oct. 2, 2021, 2:56 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
124 |
5836800 |
|
|
130568947 |
tamp_ Yousef_Salama |
H |
Oct. 2, 2021, 2:01 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
124 |
5836800 |
|
|
130579380 |
maspy |
H |
Oct. 2, 2021, 3:47 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
171 |
4403200 |
|
|
130578330 |
RedstoneGamer22 Autron AlexLuchianov |
H |
Oct. 2, 2021, 3:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
31 |
6348800 |
|
|
130570126 |
dendi239 Barichek Valera_Grinenko |
H |
Oct. 2, 2021, 2:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
4915200 |
|
|
130586192 |
new_doubleh |
H |
Oct. 2, 2021, 5:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5017600 |
|
|
130591905 |
.-O_O-. shashankagrawal |
H |
Oct. 2, 2021, 6:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5120000 |
|
|
130583147 |
abhinavvv306 Dragnoid99 mohanraghug |
H |
Oct. 2, 2021, 4:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5120000 |
|
|
130579426 |
emthrm |
H |
Oct. 2, 2021, 3:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5222400 |
|
|
130582467 |
doing_cloth tramphong QuangBuiYT |
H |
Oct. 2, 2021, 4:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5324800 |
|
|
130571659 |
SSRS_ |
H |
Oct. 2, 2021, 2:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
5529600 |
|
|
130572920 |
heno239 |
H |
Oct. 2, 2021, 2:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
6348800 |
|
|
130607948 |
Life.1s.Suck |
H |
Oct. 3, 2021, 2:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
46 |
9420800 |
|
|
130575724 |
sansen |
H |
Oct. 2, 2021, 3:07 p.m. |
OK |
Rust |
TESTS |
45 |
46 |
4300800 |
|
|
remove filters
Back to search problems