#P8013. [COCI 2013/2014 #4] GMO
[COCI 2013/2014 #4] GMO
Problem Description
Given a string consisting of A C G T, you need to insert some A C G T into this string so that the resulting string contains the target string, and the total cost is minimized.
The costs of inserting different characters are also different.
Input Format
The first line contains a string , representing the original string.
The second line contains a string , representing the target string.
The third line contains four positive integers , which represent the cost of inserting an A, the cost of inserting a C, the cost of inserting a G, and the cost of inserting a T, respectively.
Output Format
Output one line with a positive integer, indicating the minimum cost.
GTA
CAT
5 7 1 3
10
TATA
CACA
3 0 3 0
3
TCGCGAG
TGCAG
10 10 15 15
25
Hint
Sample Explanation #1.
Among the possible methods is: GTCAT, with cost , and it can be proven to be the minimum cost.
Constraints.
For of the testdata, .
For of the testdata, , , .
Source.
The score of this problem follows the original COCI problem settings, with a full score of .
This problem is translated from COCI2013-2014 CONTEST #4 T2 GMO.
Translated by ChatGPT 5