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 strings s and t consisting of lowercase Latin letters. The length of t is 2 (i.e. this string consists only of two characters). In one move, you can choose any character of s and replace it with any lowercase Latin letter. More formally, you choose some i and replace s_i (the character at the position i ) with some character from 'a ' to 'z '. You want to do no more than k replacements in such a way that maximizes the number of occurrences of t in s as a subsequence. Recall that a subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements. The first line of the input contains two integers n and k ( 2 <= n <= 200 ; 0 <= k <= n ) -- the length of s and the maximum number of moves you can make. The second line of the input contains the string s consisting of n lowercase Latin letters. The third line of the input contains the string t consisting of two lowercase Latin letters. Print one integer -- the maximum possible number of occurrences of t in s as a subsequence if you replace no more than k characters in s optimally. In the first example, you can obtain the string "abab" replacing s_1 with 'a ' and s_4 with 'b '. Then the answer is 3 . In the second example, you can obtain the string "ssddsdd" and get the answer 10 . In the fourth example, you can obtain the string "aaacaaa" and get the answer 15 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91878358 |
Larry0101 |
F |
Sept. 4, 2020, 4:49 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
204800 |
|
|
91884020 |
Anish1712 |
F |
Sept. 4, 2020, 5:53 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
32358400 |
|
|
91907127 |
zhltao |
F |
Sept. 5, 2020, 4:50 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
33075200 |
|
|
91905045 |
luogu_bot4 |
F |
Sept. 5, 2020, 4:03 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
33075200 |
|
|
91881720 |
NakiriAyame |
F |
Sept. 4, 2020, 5:23 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
33075200 |
|
|
91909826 |
GGAutomaton |
F |
Sept. 5, 2020, 5:41 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
34508800 |
|
|
91906620 |
adminxx |
F |
Sept. 5, 2020, 4:40 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
34508800 |
|
|
91904702 |
Ryan4253 |
F |
Sept. 5, 2020, 3:55 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
34508800 |
|
|
91902556 |
Wall_breaker |
F |
Sept. 5, 2020, 2:59 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
34508800 |
|
|
91902517 |
Wall_breaker |
F |
Sept. 5, 2020, 2:58 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
34508800 |
|
|
91903051 |
apurvmayank |
F |
Sept. 5, 2020, 3:13 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
307200 |
|
|
91900543 |
casperwang |
F |
Sept. 5, 2020, 1:54 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
32563200 |
|
|
91880153 |
urururu |
F |
Sept. 4, 2020, 5:05 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
32563200 |
|
|
91906974 |
_HYX_ |
F |
Sept. 5, 2020, 4:47 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
34508800 |
|
|
91876929 |
tac |
F |
Sept. 4, 2020, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
34508800 |
|
|
91902119 |
vjudge5 |
F |
Sept. 5, 2020, 2:47 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
34816000 |
|
|
91910865 |
vjudge1 |
F |
Sept. 5, 2020, 5:58 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
37171200 |
|
|
91872179 |
antguz |
F |
Sept. 4, 2020, 4:28 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
67276800 |
|
|
91896653 |
RedAnt |
F |
Sept. 4, 2020, 10:47 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
61 |
33075200 |
|
|
91875302 |
xor_pilot |
F |
Sept. 4, 2020, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
61 |
33075200 |
|
|
91890129 |
berocs |
F |
Sept. 4, 2020, 7:32 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
31 |
204800 |
|
|
91899746 |
valentinchipuc |
F |
Sept. 5, 2020, 1:23 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
307200 |
|
|
91896940 |
kaiboy |
F |
Sept. 4, 2020, 11 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
307200 |
|
|
91885679 |
CodigoL |
F |
Sept. 4, 2020, 6:17 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
409600 |
|
|
91902561 |
cjnwq |
F |
Sept. 5, 2020, 3 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
512000 |
|
|
91897426 |
ShJ |
F |
Sept. 4, 2020, 11:25 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
614400 |
|
|
91894374 |
penguinhacker |
F |
Sept. 4, 2020, 9:23 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
614400 |
|
|
91876957 |
Anonimka6 |
F |
Sept. 4, 2020, 4:40 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
614400 |
|
|
91882407 |
klimoza |
F |
Sept. 4, 2020, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
32768000 |
|
|
91881200 |
28164767TuanAnhND |
F |
Sept. 4, 2020, 5:16 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
32768000 |
|
|
91893294 |
wistful23 |
F |
Sept. 4, 2020, 8:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
31 |
409600 |
|
|
91881688 |
jacob.b.zhang |
F |
Sept. 4, 2020, 5:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
31 |
409600 |
|
|
91896520 |
lucifer1004 |
F |
Sept. 4, 2020, 10:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
31 |
614400 |
|
|
91883712 |
wassim.omais |
F |
Sept. 4, 2020, 5:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
31 |
37171200 |
|
|
91897337 |
universe- |
F |
Sept. 4, 2020, 11:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
102400 |
|
|
91893277 |
Abugozah |
F |
Sept. 4, 2020, 8:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
614400 |
|
|
91882663 |
ucrop |
F |
Sept. 4, 2020, 5:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
32460800 |
|
|
91879601 |
nippletwister |
F |
Sept. 4, 2020, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
32563200 |
|
|
91894301 |
jainbot27 |
F |
Sept. 4, 2020, 9:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
32768000 |
|
|
91888011 |
pac-man21 |
F |
Sept. 4, 2020, 6:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
46 |
33792000 |
|
|
91872048 |
meooow |
F |
Sept. 4, 2020, 4:28 p.m. |
OK |
Go |
TESTS |
50 |
78 |
68403200 |
|
|
91903625 |
Jael |
F |
Sept. 5, 2020, 3:28 a.m. |
OK |
Java 11 |
TESTS |
50 |
249 |
39936000 |
|
|
91904385 |
rreeennnnn |
F |
Sept. 5, 2020, 3:47 a.m. |
OK |
Java 11 |
TESTS |
50 |
280 |
39526400 |
|
|
91887792 |
adi0311 |
F |
Sept. 4, 2020, 6:52 p.m. |
OK |
Java 11 |
TESTS |
50 |
296 |
39424000 |
|
|
91877408 |
Kimo_Fathy |
F |
Sept. 4, 2020, 4:42 p.m. |
OK |
Java 11 |
TESTS |
50 |
311 |
39424000 |
|
|
91883607 |
sf14t |
F |
Sept. 4, 2020, 5:47 p.m. |
OK |
Java 11 |
TESTS |
50 |
327 |
39526400 |
|
|
91896272 |
jaynils |
F |
Sept. 4, 2020, 10:30 p.m. |
OK |
Java 11 |
TESTS |
50 |
358 |
39731200 |
|
|
91889887 |
saikaushik |
F |
Sept. 4, 2020, 7:29 p.m. |
OK |
Java 11 |
TESTS |
50 |
499 |
78643200 |
|
|
91899404 |
bobib |
F |
Sept. 5, 2020, 1:09 a.m. |
OK |
Java 11 |
TESTS |
50 |
1247 |
260403200 |
|
|
91874695 |
UniverseofHK |
F |
Sept. 4, 2020, 4:33 p.m. |
OK |
Java 11 |
TESTS |
50 |
1762 |
78950400 |
|
|
91877874 |
ShesMyNerd |
F |
Sept. 4, 2020, 4:45 p.m. |
OK |
Java 8 |
TESTS |
50 |
171 |
37888000 |
|
|
91880723 |
Peter_Fahmi |
F |
Sept. 4, 2020, 5:11 p.m. |
OK |
Java 8 |
TESTS |
50 |
171 |
38502400 |
|
|
91876250 |
G.A.T.C |
F |
Sept. 4, 2020, 4:37 p.m. |
OK |
Java 8 |
TESTS |
50 |
187 |
38502400 |
|
|
91902648 |
mwen |
F |
Sept. 5, 2020, 3:02 a.m. |
OK |
Java 8 |
TESTS |
50 |
202 |
38195200 |
|
|
91902611 |
mwen |
F |
Sept. 5, 2020, 3:01 a.m. |
OK |
Java 8 |
TESTS |
50 |
202 |
38195200 |
|
|
91888261 |
JunBinLiang |
F |
Sept. 4, 2020, 7 p.m. |
OK |
Java 8 |
TESTS |
50 |
202 |
42393600 |
|
|
91888243 |
JunBinLiang |
F |
Sept. 4, 2020, 6:59 p.m. |
OK |
Java 8 |
TESTS |
50 |
218 |
42393600 |
|
|
91871528 |
Naman_123 |
F |
Sept. 4, 2020, 4:27 p.m. |
OK |
Java 8 |
TESTS |
50 |
233 |
77619200 |
|
|
91908941 |
MartyByrde |
F |
Sept. 5, 2020, 5:25 a.m. |
OK |
Java 8 |
TESTS |
50 |
249 |
37888000 |
|
|
91888008 |
Hossam |
F |
Sept. 4, 2020, 6:55 p.m. |
OK |
Java 8 |
TESTS |
50 |
264 |
75673600 |
|
|
91893878 |
songsinger |
F |
Sept. 4, 2020, 9:07 p.m. |
OK |
Kotlin |
TESTS |
50 |
1512 |
1331200 |
|
|
91880392 |
terry_u16 |
F |
Sept. 4, 2020, 5:08 p.m. |
OK |
Mono C# |
TESTS |
50 |
233 |
36454400 |
|
|
91880569 |
Yupiteru |
F |
Sept. 4, 2020, 5:09 p.m. |
OK |
Mono C# |
TESTS |
50 |
421 |
67584000 |
|
|
91877944 |
xsc |
F |
Sept. 4, 2020, 4:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
50 |
93 |
33280000 |
|
|
91898227 |
reikiriyama |
F |
Sept. 5, 2020, 12:07 a.m. |
OK |
MS C++ 2017 |
TESTS |
50 |
93 |
69017600 |
|
|
91883018 |
lebron87 |
F |
Sept. 4, 2020, 5:39 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
779 |
66764800 |
|
|
91883211 |
lebron87 |
F |
Sept. 4, 2020, 5:42 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
779 |
67379200 |
|
|
91883133 |
lebron87 |
F |
Sept. 4, 2020, 5:41 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
826 |
67379200 |
|
|
91882935 |
lebron87 |
F |
Sept. 4, 2020, 5:38 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
826 |
68300800 |
|
|
91879947 |
bestwillcui |
F |
Sept. 4, 2020, 5:03 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
171 |
2150400 |
|
|
91904452 |
mkawa2 |
F |
Sept. 5, 2020, 3:48 a.m. |
OK |
PyPy 3 |
TESTS |
50 |
249 |
4608000 |
|
|
91878019 |
titia |
F |
Sept. 4, 2020, 4:46 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
326 |
5324800 |
|
|
91907783 |
gintoki_s |
F |
Sept. 5, 2020, 5:04 a.m. |
OK |
PyPy 3 |
TESTS |
50 |
405 |
40243200 |
|
|
91891390 |
Kanna-Chan |
F |
Sept. 4, 2020, 7:58 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
436 |
40243200 |
|
|
91892208 |
Nifer |
F |
Sept. 4, 2020, 8:19 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
732 |
68198400 |
|
|
91892369 |
Nifer |
F |
Sept. 4, 2020, 8:23 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
764 |
67993600 |
|
|
91881084 |
throwawayatcoder |
F |
Sept. 4, 2020, 5:15 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
826 |
69427200 |
|
|
91880325 |
aanya02 |
F |
Sept. 4, 2020, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
857 |
104448000 |
|
|
91881031 |
sh1194 |
F |
Sept. 4, 2020, 5:14 p.m. |
OK |
Python 3 |
TESTS |
50 |
140 |
307200 |
|
|
91880413 |
sh1194 |
F |
Sept. 4, 2020, 5:08 p.m. |
OK |
Python 3 |
TESTS |
50 |
140 |
307200 |
|
|
91880753 |
sh1194 |
F |
Sept. 4, 2020, 5:11 p.m. |
OK |
Python 3 |
TESTS |
50 |
155 |
307200 |
|
|
remove filters
Back to search problems