cf/mirror

Subsequences (hard version)

CF
1183H1900· candidate master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 4
Input
4 5
asdf
Output
4
Sample 2of 4
Input
5 6
aaaaa
Output
15
Sample 3of 4
Input
5 7
aaaaa
Output
-1
Sample 4of 4
Input
10 100
ajihiushda
Output
233
1183H.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)