CF1733D1 Zero-One (Easy Version)

题目描述

两个长度为 $n$ 的二进制字符串 $a$ 和 $b$。你可以进行如下操作若干次(可以为0次): - 选两个数 $l$ 和 $r\ $ $(\ l\

输入格式

第一行一个整数 $t$ $(1\le t\le 600)$,表示数据组数。 每组第一行三个整数 $n$、$x$、$y$ $(\ 5\le n\le 3000\ ,1\le y\le x\le10^9)$,表示字符串长度,以及单次操作代价。 第二行 $a$,第三行 $b$,保证只包含0和1,长度为 $n$。

输出格式

对于每组数据,一行一个整数,表示使 $a$ 等于 $b$ 的最小代价,或是 $-1$ 表示无解。

说明/提示

In the first test case, selecting indices $ 2 $ and $ 3 $ costs $ 8 $ , which is the minimum possible cost. In the second test case, we cannot make $ a $ equal to $ b $ using any number of operations. In the third test case, we can perform the following operations: - Select indices $ 3 $ and $ 6 $ . It costs $ 3 $ , and $ a $ is 0101011 now. - Select indices $ 4 $ and $ 6 $ . It costs $ 3 $ , and $ a $ is 0100001 now. The total cost is $ 6 $ . In the fourth test case, we don't have to perform any operations.