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 are given a binary string ^ dagger s of length n . A binary string p of the same length n is called good if for every i ( 1 <= q i <= q n ), there exist indices l and r such that: You are given another binary string t of length n . Find the minimum Hamming distance ^ S between t and any good string g . ^ dagger A binary string is a string that only consists of characters mathtt{0} and mathtt{1} . ^ ddagger Character c is a mode of string p of length m if the number of occurrences of c in p is at least lceil frac{m}{2} rceil . For example, mathtt{0} is a mode of mathtt{010} , mathtt{1} is not a mode of mathtt{010} , and both mathtt{0} and mathtt{1} are modes of mathtt{011010} . ^ S The Hamming distance of strings a and b of length m is the number of indices i such that 1 <= q i <= q m and a_i neq b_i . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 10^4 ) -- the length of the binary string s . The second line of each test case contains a binary string s of length n consisting of characters 0 and 1. The third line of each test case contains a binary string t of length n consisting of characters 0 and 1. It is guaranteed that the sum of n over all test cases does not exceed 10^6 , with the additional assurance that the sum of n^2 over all test cases does not exceed 10^8 For each test case, print the minimum Hamming distance between t and any good string g . In the first test case, g= mathtt{000} is a good string which has Hamming distance 0 from t . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
251821021 |
jeroenodb |
F |
March 16, 2024, 8:26 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
187 |
307200 |
|
|
251833904 |
maroo1234 |
F |
March 16, 2024, 10:28 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
202 |
307200 |
|
|
251830742 |
mohdsuhailkhan |
F |
March 16, 2024, 9:49 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
202 |
307200 |
|
|
251820083 |
jeroenodb |
F |
March 16, 2024, 8:19 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
202 |
307200 |
|
|
251810671 |
kostia244 |
F |
March 16, 2024, 7:04 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
607 |
512000 |
|
|
251783880 |
VivaciousAubergine |
F |
March 16, 2024, 4:37 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
1886 |
802713600 |
|
|
251845260 |
Ormlis |
F |
March 17, 2024, 1:43 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
2682 |
802611200 |
|
|
251801182 |
Benq |
F |
March 16, 2024, 6:28 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
3103 |
603136000 |
|
|
remove filters
Back to search problems