QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#4321. 匹配

統計

题目描述

定义“匹配项”是一个长度为 $L$ 的字符串,每一位要么是0,要么是1。现在有$N$个这样的“匹配项”,我们希望设计一个“方案”,“方案”同样是长度为$L$的字符串,每一位要么是0,要么是1。定义每个“匹配项”的错误值为“方案”与“匹配项”不同位的个数,比如“匹配项”是101,“方案”是000,那么两者的第一位和第三位是不同的,所以该“方案”对于该“匹配项”的错误值为2。我们希望找到一个“方案”,使得这$N$个“匹配项”的错误值之和最小。此外,有$M$个互不相同的禁用“方案”,我们要求找到的“方案”不能是禁用“方案”之一。

输入格式

输入的第一行包含三个正整数 $N,M,L$,保证 $1 \le N \le 1000$, $1 \le M \le \min(1000,2^L-1) $, $ 1 \le L \le 1000 $。

接下来输入 $N$ 行,每行为一个长度为$L$的字符串,之后$M$行,每行为一个长度为$L$的字符串。

输出格式

输出一个整数,表示满足要求的“方案”得到的这$N$个“匹配项”的最小错误值之和。

样例数据

样例 1 输入

4 1 4
0000
1000
1100
1010
1000

样例 1 输出

5

样例 2 输入

2 4 4
0000
0000
0000
1000
0100
0010

样例 2 输出

2
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.