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"Masha meets a new friend and learns his phone number -- s . She wants to remember it as soon as possible. The phone number -- is a string of length m that consists of digits from 0 to 9 . The phone number may start with 0. Masha already knows n phone numbers (all numbers have the same length m ). It will be easier for her to remember a new number if the s is represented as segments of numbers she already knows. Each such segment must be of length at least 2 , otherwise there will be too many segments and Masha will get confused. For example, Masha needs to remember the number: s = '12345678' and she already knows n = 4 numbers: '12340219', '20215601', '56782022', '12300678'. You can represent s as a 3 segment: '1234' of number one, '56' of number two, and '78' of number three. There are other ways to represent s . Masha asks you for help, she asks you to break the string s into segments of length 2 or more of the numbers she already knows. If there are several possible answers, print any of them. The first line of input data contains an integer t ( 1 <= t <= 10^4 ) --the number of test cases. Before each test case there is a blank line. Then there is a line containing integers n and m ( 1 <= n, m <= 10^3 ) --the number of phone numbers that Masha knows and the number of digits in each phone number. Then follow n line, i -th of which describes the i -th number that Masha knows. The next line contains the phone number of her new friend s . Among the given n+1 phones, there may be duplicates (identical phones). It is guaranteed that the sum of n cdot m ( n multiplied by m ) values over all input test cases does not exceed 10^6 . You need to print the answers to t test cases. The first line of the answer should contain one number k , corresponding to the number of segments into w"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
142298055 |
parthu |
E |
Jan. 10, 2022, 6:04 p.m. |
OK |
GNU C11 |
TESTS |
24 |
2277 |
4403200 |
|
|
142291338 |
_Infinite_v0id_ |
E |
Jan. 10, 2022, 5:04 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
46 |
307200 |
|
|
142289510 |
NamelessOIer |
E |
Jan. 10, 2022, 4:53 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
46 |
1536000 |
|
|
142320072 |
duoluoluo |
E |
Jan. 11, 2022, 3:29 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
124 |
102400 |
|
|
142315999 |
yyyz04 |
E |
Jan. 11, 2022, 1:47 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
140 |
9011200 |
|
|
142296256 |
MovingFat |
E |
Jan. 10, 2022, 5:45 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
155 |
1945600 |
|
|
142308423 |
SUZUKO_DAZE |
E |
Jan. 10, 2022, 8:42 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
155 |
133529600 |
|
|
142298360 |
AJAY_VAIBHAV |
E |
Jan. 10, 2022, 6:07 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
186 |
1945600 |
|
|
142323908 |
1564269628 |
E |
Jan. 11, 2022, 4:40 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
187 |
204800 |
|
|
142319275 |
1564269628 |
E |
Jan. 11, 2022, 3:13 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
202 |
204800 |
|
|
142297876 |
99_wood |
E |
Jan. 10, 2022, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
202 |
4198400 |
|
|
142288260 |
Star_Dream |
E |
Jan. 10, 2022, 4:49 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
46 |
0 |
|
|
142289112 |
Ydot |
E |
Jan. 10, 2022, 4:52 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
46 |
204800 |
|
|
142290120 |
farmerboy |
E |
Jan. 10, 2022, 4:56 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
61 |
1843200 |
|
|
142288740 |
M1sakiQAQ |
E |
Jan. 10, 2022, 4:51 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
204800 |
|
|
142291699 |
HoangCoder |
E |
Jan. 10, 2022, 5:06 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
204800 |
|
|
142287583 |
smit.mangukiya |
E |
Jan. 10, 2022, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
512000 |
|
|
142287386 |
nvllable |
E |
Jan. 10, 2022, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
2048000 |
|
|
142294854 |
xuan13853715014 |
E |
Jan. 10, 2022, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
78 |
0 |
|
|
142319904 |
hunanligong |
E |
Jan. 11, 2022, 3:26 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
124 |
1024000 |
|
|
142289258 |
vd__coder |
E |
Jan. 10, 2022, 4:52 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
1945600 |
|
|
142292306 |
LeVanThuc |
E |
Jan. 10, 2022, 5:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
409600 |
|
|
142290886 |
BrayanD |
E |
Jan. 10, 2022, 5:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
139 |
409600 |
|
|
142293917 |
cjoa |
E |
Jan. 10, 2022, 5:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
140 |
1126400 |
|
|
142301130 |
propane |
E |
Jan. 10, 2022, 6:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
155 |
102400 |
|
|
142325613 |
tsy_666 |
E |
Jan. 11, 2022, 5:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
155 |
4300800 |
|
|
142301441 |
kira11 |
E |
Jan. 10, 2022, 6:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
156 |
204800 |
|
|
142287428 |
keyboard_virtuoso |
E |
Jan. 10, 2022, 4:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
156 |
2252800 |
|
|
142327892 |
SantoriN2k |
E |
Jan. 11, 2022, 5:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
171 |
102400 |
|
|
142304708 |
moo. |
E |
Jan. 10, 2022, 7:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
171 |
307200 |
|
|
142298092 |
PPTenshi_Heimin |
E |
Jan. 10, 2022, 6:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
234 |
2150400 |
|
|
142291971 |
Meul |
E |
Jan. 10, 2022, 5:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
46 |
102400 |
|
|
142291906 |
Meul |
E |
Jan. 10, 2022, 5:07 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
46 |
102400 |
|
|
142290518 |
Meul |
E |
Jan. 10, 2022, 4:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
46 |
102400 |
|
|
142291279 |
AsukaKyle |
E |
Jan. 10, 2022, 5:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
46 |
921600 |
|
|
142292477 |
ShlokG |
E |
Jan. 10, 2022, 5:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
62 |
2048000 |
|
|
142293218 |
Meul |
E |
Jan. 10, 2022, 5:17 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
93 |
102400 |
|
|
142287115 |
OG_Matveychick1 |
E |
Jan. 10, 2022, 4:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
93 |
409600 |
|
|
142290375 |
shjohw12 |
E |
Jan. 10, 2022, 4:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
93 |
51507200 |
|
|
142293509 |
Meul |
E |
Jan. 10, 2022, 5:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
108 |
102400 |
|
|
142293301 |
Meul |
E |
Jan. 10, 2022, 5:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
108 |
102400 |
|
|
142308284 |
henrychenOutlook |
E |
Jan. 10, 2022, 8:39 p.m. |
OK |
Java 11 |
TESTS |
24 |
358 |
0 |
|
|
142287497 |
Ahmed_Hosssam |
E |
Jan. 10, 2022, 4:48 p.m. |
OK |
Java 11 |
TESTS |
21 |
498 |
0 |
|
|
142298358 |
pras7946 |
E |
Jan. 10, 2022, 6:07 p.m. |
OK |
Java 11 |
TESTS |
24 |
561 |
0 |
|
|
142309058 |
soumit915 |
E |
Jan. 10, 2022, 8:59 p.m. |
OK |
Java 11 |
TESTS |
24 |
592 |
6963200 |
|
|
142286575 |
kamranm |
E |
Jan. 10, 2022, 4:47 p.m. |
OK |
Java 8 |
TESTS |
21 |
264 |
0 |
|
|
142317828 |
Yuxiang |
E |
Jan. 11, 2022, 2:38 a.m. |
OK |
Java 8 |
TESTS |
24 |
358 |
0 |
|
|
142312050 |
vgrechko |
E |
Jan. 10, 2022, 10:43 p.m. |
OK |
Java 8 |
TESTS |
24 |
405 |
0 |
|
|
142299164 |
AllDirections |
E |
Jan. 10, 2022, 6:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
24 |
109 |
102400 |
|
|
142323916 |
andreyDagger |
E |
Jan. 11, 2022, 4:40 a.m. |
OK |
MS C++ 2017 |
TESTS |
24 |
1029 |
307200 |
|
|
142311454 |
Alexey |
E |
Jan. 10, 2022, 10:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
24 |
2323 |
1433600 |
|
|
142302431 |
dotdot1 |
E |
Jan. 10, 2022, 6:58 p.m. |
OK |
Node.js |
TESTS |
24 |
2573 |
26521600 |
|
|
142301894 |
rsFalse |
E |
Jan. 10, 2022, 6:50 p.m. |
OK |
Perl |
TESTS |
24 |
1200 |
3174400 |
|
|
142302044 |
rsFalse |
E |
Jan. 10, 2022, 6:52 p.m. |
OK |
Perl |
TESTS |
24 |
1590 |
3481600 |
|
|
142300679 |
rsFalse |
E |
Jan. 10, 2022, 6:35 p.m. |
OK |
Perl |
TESTS |
24 |
1778 |
43622400 |
|
|
142288238 |
Amiy_Tiwari |
E |
Jan. 10, 2022, 4:49 p.m. |
OK |
PyPy 3 |
TESTS |
21 |
810 |
11878400 |
|
|
142295107 |
NKUCristiano |
E |
Jan. 10, 2022, 5:33 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
1060 |
11366400 |
|
|
142303100 |
lemiao12 |
E |
Jan. 10, 2022, 7:08 p.m. |
OK |
PyPy 3 |
TESTS |
24 |
1309 |
11776000 |
|
|
142330301 |
207r1a6688 |
E |
Jan. 11, 2022, 5:59 a.m. |
OK |
PyPy 3 |
TESTS |
24 |
1403 |
11366400 |
|
|
142316016 |
whatshisbucket |
E |
Jan. 11, 2022, 1:48 a.m. |
OK |
PyPy 3 |
TESTS |
24 |
1450 |
11878400 |
|
|
142320657 |
zayn. |
E |
Jan. 11, 2022, 3:41 a.m. |
OK |
PyPy 3 |
TESTS |
24 |
1482 |
14028800 |
|
|
142293666 |
xyxoro |
E |
Jan. 10, 2022, 5:21 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
1496 |
10752000 |
|
|
142299663 |
temprunner |
E |
Jan. 10, 2022, 6:22 p.m. |
OK |
PyPy 3 |
TESTS |
24 |
1544 |
29184000 |
|
|
142328115 |
saurabh3195 |
E |
Jan. 11, 2022, 5:37 a.m. |
OK |
PyPy 3 |
TESTS |
24 |
1559 |
11673600 |
|
|
142293102 |
abc_2002 |
E |
Jan. 10, 2022, 5:16 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
2557 |
12185600 |
|
|
142295008 |
dhaval_429 |
E |
Jan. 10, 2022, 5:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
670 |
18124800 |
|
|
142291594 |
hsh8086 |
E |
Jan. 10, 2022, 5:05 p.m. |
OK |
PyPy 3-64 |
TESTS |
21 |
794 |
15872000 |
|
|
142309585 |
ding_don_dino |
E |
Jan. 10, 2022, 9:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
826 |
13414400 |
|
|
142291245 |
pruthvirg |
E |
Jan. 10, 2022, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
21 |
1075 |
14540800 |
|
|
142303233 |
lemiao12 |
E |
Jan. 10, 2022, 7:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
1185 |
11059200 |
|
|
142318027 |
zard1991- |
E |
Jan. 11, 2022, 2:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
1341 |
14643200 |
|
|
142311542 |
SirVivor |
E |
Jan. 10, 2022, 10:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
1388 |
11161600 |
|
|
142296472 |
Bloodmain |
E |
Jan. 10, 2022, 5:47 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
1419 |
5836800 |
|
|
142291455 |
Megatvini |
E |
Jan. 10, 2022, 5:04 p.m. |
OK |
PyPy 3-64 |
TESTS |
21 |
1419 |
10444800 |
|
|
142304092 |
aayush_chhabra |
E |
Jan. 10, 2022, 7:22 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
1434 |
12492800 |
|
|
142304588 |
OLOGY |
E |
Jan. 10, 2022, 7:30 p.m. |
OK |
Python 2 |
TESTS |
24 |
1855 |
9011200 |
|
|
142290740 |
bayashi_cl |
E |
Jan. 10, 2022, 5 p.m. |
OK |
Python 3 |
TESTS |
21 |
1435 |
1228800 |
|
|
142293590 |
xyxoro |
E |
Jan. 10, 2022, 5:20 p.m. |
OK |
Python 3 |
TESTS |
22 |
1934 |
1433600 |
|
|
142296977 |
maan2003 |
E |
Jan. 10, 2022, 5:52 p.m. |
OK |
Rust 2021 |
TESTS |
23 |
389 |
27340800 |
|
|
remove filters
Back to search problems