cf/mirror

Subsequence Problem

CF
2169F2700· international gm4s512 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
4 5 3
1 1 2
4
1
4 3
Output
2
Sample 2of 3
Input
3 5 2
1 1
5
2
Output
13
Sample 3of 3
Input
200000 12345678 7
3 2 5 1 3 4 5
42 13 37
37 13
1 2 3 4 5
3
3 1 4
1 5 9 2
1 2 3 4 5
Output
152094503
2169F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)