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 n strings s_1, s_2, ldots, s_n , each consisting of lowercase and uppercase English letters. In addition, it 's guaranteed that each character occurs in each string at most twice. Find the longest common subsequence of these strings. A string t is a subsequence of a string s if t can be obtained from s by deletion of several (possibly, zero or all) symbols. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 5 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= q n <= q 10 ) -- the number of strings. Each of the next n lines contains the corresponding string s_i . Each s_i is non-empty, consists only of uppercase and lowercase English letters, and no character appears more than twice in each string. For each test case print the answer in two lines: In the first line print the length of the longest common subsequence. In the second line print the longest common subsequence. If there are multiple such subsequences, print any of them. In the first test case, the longest common subsequence is "A". There are no common subsequences of length 2 . In the second test case, sets of characters of strings don 't intersect, so any non-empty string can 't be a common subsequence. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
135533007 |
Alex_Wei |
F |
Nov. 15, 2021, 2:06 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
78 |
1433600 |
|
2600 |
135395856 |
origine |
F |
Nov. 14, 2021, 8:58 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
390 |
2867200 |
|
2600 |
135503688 |
dknguyen176 |
F |
Nov. 14, 2021, 5:34 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
343 |
50176000 |
|
2600 |
135390666 |
cat998__ |
F |
Nov. 14, 2021, 8:13 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
373 |
18432000 |
|
2600 |
135499977 |
Melita. |
F |
Nov. 14, 2021, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
1903 |
15360000 |
|
2600 |
135404173 |
sunstar2020 |
F |
Nov. 14, 2021, 10:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
13926400 |
|
2600 |
135387335 |
Kirill22 |
F |
Nov. 14, 2021, 8:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
1902 |
18329600 |
|
2600 |
135379647 |
turmax |
F |
Nov. 14, 2021, 7:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
826 |
153804800 |
|
2600 |
135380841 |
Artyom123 |
F |
Nov. 14, 2021, 7:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
1621 |
4812800 |
|
2600 |
remove filters
Back to search problems