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 two binary strings a and b . A binary string is a string consisting of the characters '0' and '1'. Your task is to determine the maximum possible number k such that a prefix of string a of length k is a subsequence of string b . A sequence a is a subsequence of a sequence b if a can be obtained from b by the deletion of several (possibly, zero or all) elements. The first line consists of a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 1 <= n,m <= 2 cdot 10^5 ) -- the length of string a and the length of string b , respectively. The second line of each test case contains a binary string a of length n . The third line of each test case contains a binary string b of length m . It is guaranteed that the sum of values n over all test cases does not exceed 2 cdot 10^5 . Similarly, the sum of values m over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single number -- the maximum k , such that the first k characters of a form a subsequence of b . In the first example, the string ' 10 ' is a subsequence of ' 1 color{red}11 color{red}0 ' but the string ' 100 ' is not. So the answer is 2 . In the fifth example, a =' 100 ', b =' 1 color{red}{10}1 color{red}0 ', whole string a is a subsequence of string b . So the answer is 3 . In the sixth example, string b does not contain ' 1 ' 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 |
262196233 |
KevinTorres01 |
B |
May 22, 2024, 9:22 p.m. |
OK |
C# 10 |
TESTS |
12 |
78 |
1638400 |
|
800 |
263293776 |
justunderdog |
B |
May 30, 2024, 2:57 p.m. |
OK |
C# 10 |
TESTS |
12 |
108 |
3891200 |
|
800 |
261079608 |
hhsaffar |
B |
May 15, 2024, 4:12 p.m. |
OK |
C# 10 |
TESTS |
12 |
124 |
2560000 |
|
800 |
261723582 |
YefersonSC |
B |
May 20, 2024, 5:07 a.m. |
OK |
C# 10 |
TESTS |
12 |
937 |
3174400 |
|
800 |
262939276 |
ayuisaki |
B |
May 27, 2024, 11:08 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
262698527 |
lzm_555994 |
B |
May 26, 2024, 11:48 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
262649559 |
down1rook |
B |
May 26, 2024, 5 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
262501882 |
AbaKuS |
B |
May 25, 2024, 11:19 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261960922 |
mayanksingal |
B |
May 21, 2024, 4:23 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261793483 |
susmitha_seeta |
B |
May 20, 2024, 2:26 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261687225 |
GVJNJ |
B |
May 19, 2024, 5:46 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261497993 |
vjudge3 |
B |
May 18, 2024, 9:15 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261483296 |
Lightwhite |
B |
May 18, 2024, 7:46 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
261392025 |
vPrhkstnfus |
B |
May 17, 2024, 3:56 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263702708 |
Turaka |
B |
June 2, 2024, 5:29 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263698902 |
raghavgupta256 |
B |
June 2, 2024, 4:35 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263663829 |
arivwalia |
B |
June 1, 2024, 5:29 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263652310 |
sarthak2jain |
B |
June 1, 2024, 3:53 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263634516 |
hitman_007 |
B |
June 1, 2024, 1:20 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263631942 |
r.v.11.11 |
B |
June 1, 2024, 12:56 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263602419 |
elotelo10 |
B |
June 1, 2024, 8:57 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263579958 |
vivekkk999 |
B |
June 1, 2024, 5:47 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263575941 |
jainil24 |
B |
June 1, 2024, 5:02 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263552698 |
Hawkwatch_19 |
B |
May 31, 2024, 9:46 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
12 |
46 |
0 |
|
800 |
263684643 |
Sameer-Abu-Elneel |
B |
June 1, 2024, 10:35 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263643684 |
Darshan_7 |
B |
June 1, 2024, 2:38 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263564214 |
changtian. |
B |
June 1, 2024, 2:26 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263423389 |
Abu_Anas04 |
B |
May 31, 2024, 6:42 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263413428 |
rogerthat |
B |
May 31, 2024, 5:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263401626 |
Afrinnimu |
B |
May 31, 2024, 2:54 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263395813 |
Maram_M |
B |
May 31, 2024, 12:54 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263385245 |
Radha_bansal |
B |
May 30, 2024, 8:35 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263175714 |
drayeniv |
B |
May 29, 2024, 6:25 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
263166899 |
Ria-2005 |
B |
May 29, 2024, 4:13 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
12 |
46 |
0 |
|
800 |
262272273 |
NGC6543 |
B |
May 23, 2024, 2:24 p.m. |
OK |
GNU C11 |
TESTS |
12 |
61 |
409600 |
|
800 |
261401355 |
Bartwal |
B |
May 17, 2024, 4:17 p.m. |
OK |
GNU C11 |
TESTS |
12 |
62 |
409600 |
|
800 |
261532950 |
SanyamIIIT |
B |
May 18, 2024, 12:58 p.m. |
OK |
GNU C11 |
TESTS |
12 |
77 |
512000 |
|
800 |
261064620 |
lgdg |
B |
May 15, 2024, 1:57 p.m. |
OK |
GNU C11 |
TESTS |
12 |
77 |
512000 |
|
800 |
261165868 |
cccccqw |
B |
May 16, 2024, 8:33 a.m. |
OK |
GNU C11 |
TESTS |
12 |
78 |
307200 |
|
800 |
261967015 |
akshayakodam |
B |
May 21, 2024, 5:42 a.m. |
OK |
GNU C11 |
TESTS |
12 |
78 |
512000 |
|
800 |
263162130 |
Sajid109 |
B |
May 29, 2024, 3:24 p.m. |
OK |
GNU C11 |
TESTS |
12 |
92 |
409600 |
|
800 |
262273919 |
adaneya |
B |
May 23, 2024, 2:36 p.m. |
OK |
GNU C11 |
TESTS |
12 |
92 |
409600 |
|
800 |
262271634 |
CC-Princess |
B |
May 23, 2024, 2:18 p.m. |
OK |
GNU C11 |
TESTS |
12 |
92 |
512000 |
|
800 |
262269911 |
yyy.395 |
B |
May 23, 2024, 2:05 p.m. |
OK |
GNU C11 |
TESTS |
12 |
93 |
512000 |
|
800 |
261071280 |
Martynas |
B |
May 15, 2024, 2:53 p.m. |
OK |
Go |
TESTS |
12 |
62 |
1740800 |
|
800 |
261732945 |
xin2002 |
B |
May 20, 2024, 6:58 a.m. |
OK |
Java 21 |
TESTS |
12 |
218 |
512000 |
|
800 |
263065565 |
mangos194 |
B |
May 28, 2024, 9:15 p.m. |
OK |
Java 21 |
TESTS |
12 |
234 |
307200 |
|
800 |
262642636 |
AKhacks |
B |
May 26, 2024, 3:39 a.m. |
OK |
Java 21 |
TESTS |
12 |
249 |
614400 |
|
800 |
263428720 |
yashmishra.vapi |
B |
May 31, 2024, 7:23 a.m. |
OK |
Java 21 |
TESTS |
12 |
249 |
1228800 |
|
800 |
261163397 |
duffyishere |
B |
May 16, 2024, 8:12 a.m. |
OK |
Java 21 |
TESTS |
12 |
249 |
1740800 |
|
800 |
263557175 |
SD125 |
B |
May 31, 2024, 11:43 p.m. |
OK |
Java 21 |
TESTS |
12 |
249 |
8499200 |
|
800 |
261744603 |
anshgrover25072002 |
B |
May 20, 2024, 8:27 a.m. |
OK |
Java 21 |
TESTS |
12 |
280 |
512000 |
|
800 |
263439142 |
himanshu_1504 |
B |
May 31, 2024, 8:53 a.m. |
OK |
Java 21 |
TESTS |
12 |
281 |
512000 |
|
800 |
261072148 |
pvantien203 |
B |
May 15, 2024, 3:01 p.m. |
OK |
Java 21 |
TESTS |
12 |
296 |
921600 |
|
800 |
262856925 |
IrhamMA |
B |
May 27, 2024, 9:24 a.m. |
OK |
Java 21 |
TESTS |
12 |
311 |
1024000 |
|
800 |
261724911 |
YeCan |
B |
May 20, 2024, 5:26 a.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
800 |
261548598 |
aman28rwt |
B |
May 18, 2024, 3:15 p.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
800 |
262865367 |
tittiesboy99 |
B |
May 27, 2024, 10:38 a.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
0 |
|
800 |
261755067 |
Me146 |
B |
May 20, 2024, 9:31 a.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
0 |
|
800 |
261724945 |
luogu_bot1 |
B |
May 20, 2024, 5:26 a.m. |
OK |
Java 8 |
TESTS |
12 |
156 |
0 |
|
800 |
261541017 |
strind |
B |
May 18, 2024, 2:12 p.m. |
OK |
Java 8 |
TESTS |
12 |
156 |
0 |
|
800 |
261217763 |
vatsal_04 |
B |
May 16, 2024, 3:19 p.m. |
OK |
Java 8 |
TESTS |
12 |
171 |
0 |
|
800 |
261275487 |
Hemant_malav |
B |
May 17, 2024, 4:54 a.m. |
OK |
Java 8 |
TESTS |
12 |
171 |
8499200 |
|
800 |
261773702 |
Dev3161 |
B |
May 20, 2024, 11:55 a.m. |
OK |
Java 8 |
TESTS |
12 |
186 |
0 |
|
800 |
261724586 |
YeCan |
B |
May 20, 2024, 5:21 a.m. |
OK |
Java 8 |
TESTS |
12 |
186 |
0 |
|
800 |
262063499 |
nesco |
B |
May 21, 2024, 6:30 p.m. |
OK |
Kotlin 1.7 |
TESTS |
12 |
374 |
18841600 |
|
800 |
263388335 |
Kay0 |
B |
May 30, 2024, 9:30 p.m. |
OK |
Kotlin 1.9 |
TESTS |
12 |
202 |
204800 |
|
800 |
262846092 |
parth_7042 |
B |
May 27, 2024, 7:51 a.m. |
OK |
PHP |
TESTS |
12 |
93 |
0 |
|
800 |
262625706 |
NitroSpear |
B |
May 25, 2024, 9:04 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
171 |
7065600 |
|
800 |
262455198 |
Lavanyaadapa |
B |
May 25, 2024, 4:03 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
296 |
6348800 |
|
800 |
261778174 |
vjudge.1 |
B |
May 20, 2024, 12:28 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
296 |
6348800 |
|
800 |
263622409 |
Vidusheey09 |
B |
June 1, 2024, 11:36 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
296 |
6860800 |
|
800 |
262485311 |
klu-2100030642 |
B |
May 25, 2024, 9:05 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
312 |
6246400 |
|
800 |
261234422 |
sniper2_45 |
B |
May 16, 2024, 5:31 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
342 |
6144000 |
|
800 |
261624102 |
Aditya_hckr |
B |
May 19, 2024, 8:29 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
343 |
8806400 |
|
800 |
261697024 |
mahnameisayush |
B |
May 19, 2024, 7:35 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
374 |
9932800 |
|
800 |
261146275 |
JackQin |
B |
May 16, 2024, 5:48 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
93 |
4300800 |
|
800 |
261734387 |
shuby |
B |
May 20, 2024, 7:13 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
93 |
4812800 |
|
800 |
261319896 |
Rache_Bartmoss |
B |
May 17, 2024, 11:22 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
108 |
3379200 |
|
800 |
261472338 |
tomasnyberg |
B |
May 18, 2024, 6:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
108 |
8499200 |
|
800 |
261702183 |
sathvik_67 |
B |
May 19, 2024, 8:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
124 |
6041600 |
|
800 |
261783882 |
abhicoder_0 |
B |
May 20, 2024, 1:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
140 |
21913600 |
|
800 |
262431856 |
Polynomu |
B |
May 24, 2024, 7:36 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
155 |
7884800 |
|
800 |
262976800 |
wyf0722 |
B |
May 28, 2024, 7:50 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
155 |
8294400 |
|
800 |
262091779 |
TediousR |
B |
May 22, 2024, 5:25 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
156 |
22425600 |
|
800 |
262335435 |
Taymyr |
B |
May 24, 2024, 5:06 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
171 |
3993600 |
|
800 |
261734227 |
shuby |
B |
May 20, 2024, 7:12 a.m. |
OK |
Python 3 |
TESTS |
12 |
78 |
1638400 |
|
800 |
262482935 |
klu-2100030642 |
B |
May 25, 2024, 8:47 a.m. |
OK |
Python 3 |
TESTS |
12 |
93 |
409600 |
|
800 |
261756050 |
hju013961 |
B |
May 20, 2024, 9:39 a.m. |
OK |
Python 3 |
TESTS |
12 |
93 |
409600 |
|
800 |
262409727 |
saigayathri_122 |
B |
May 24, 2024, 3:55 p.m. |
OK |
Python 3 |
TESTS |
12 |
108 |
409600 |
|
800 |
261683164 |
Shaurya_Anant |
B |
May 19, 2024, 5:07 p.m. |
OK |
Python 3 |
TESTS |
12 |
108 |
409600 |
|
800 |
263030193 |
kienthanhphan260607 |
B |
May 28, 2024, 3:09 p.m. |
OK |
Python 3 |
TESTS |
12 |
108 |
512000 |
|
800 |
261996287 |
KKnotalone |
B |
May 21, 2024, 10:13 a.m. |
OK |
Python 3 |
TESTS |
12 |
108 |
1740800 |
|
800 |
263564160 |
DenialC |
B |
June 1, 2024, 2:25 a.m. |
OK |
Python 3 |
TESTS |
12 |
109 |
409600 |
|
800 |
263135501 |
Avinash_27 |
B |
May 29, 2024, 11:49 a.m. |
OK |
Python 3 |
TESTS |
12 |
109 |
409600 |
|
800 |
262158679 |
samoylovboris |
B |
May 22, 2024, 2:45 p.m. |
OK |
Python 3 |
TESTS |
12 |
109 |
409600 |
|
800 |
261546955 |
kokatsu |
B |
May 18, 2024, 3:02 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
61 |
0 |
|
800 |
262111861 |
naut3 |
B |
May 22, 2024, 8:16 a.m. |
OK |
Rust 2021 |
TESTS |
12 |
62 |
0 |
|
800 |
261553024 |
Tardimgg |
B |
May 18, 2024, 3:50 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
155 |
0 |
|
800 |
remove filters
Back to search problems