{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"给定一个字符串S,字符串S的长度为M,字符串S所含有的字符的种类的数量为N(最多26种小写字母),然后给定这N种字符Add与Delete的代价,求将S变为回文串的最小代价和。"}},{"title":"Input","value":{"format":"MD","content":"Line 1: Two space-separated integers: N and M \n(第一行:两个由空格分隔的整数 N 和 M )\nLine 2: This line contains exactly M characters which constitute the initial ID string \n(第二行:这一行给出了恰好 M 个字符,表示初始状态下的ID字符串)\nLines 3..N+2: Each line contains three space-separated entities: a character of the input alphabet and two integers which are respectively the cost of adding and deleting that character.\n(接下来的 N 行:每一行给出了由空格分隔的三部分。首先是一个字符,保证出现在了输入的字符串中。接下来是两个整数,表示你增添这个字符的代价,然后是删除这个字符的代价)"}},{"title":"Output","value":{"format":"MD","content":"Line 1: A single line with a single integer that is the minimum cost to change the given name tag.\n(你只需要输出一行,且只输出一个整数。表示你将给定字符串变成回文串所需的最小代价。)"}},{"title":"Sample Input","value":{"format":"MD","content":"\u003cpre class\u003d\"sio\"\u003e3 4\nabcb\na 1000 1100\nb 350 700\nc 200 800\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"MD","content":"\u003cpre class\u003d\"sio\"\u003e900\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"MD","content":""}}]}