| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 1 | 1 | 1 | 100.000% |
A pattern is defined as a binary string of length $L$. Given $n$ patterns, we want to find a key which is also a binary string of length $L$.
For a given pattern and a given key, the error value is defined as the number of positions where the key differs from the pattern. For example, if the pattern is 101, and the key is 000, then the first and third positions are different, so the error value is 2ドル$.
We want to find a key such that the sum of the error values for this key and the given $n$ patterns is minimized. Additionally, there are $m$ distinct forbidden keys, and the key we find cannot be one of the forbidden keys.
The first line of input contains three integers, $n,ドル $m,ドル and $L$ (1ドル \le n \le 1000$; 1ドル \le m \le \min(1000, 2^L - 1)$; 1ドル \le L \le 1000$).
Each of the following $n$ lines represents a pattern and contains a binary string of length $L$.
Each of the following $m$ lines represents a forbidden key and contains a binary string of length $L$. All forbidden keys are distinct.
Output a single integer: the minimum sum of error values for a non-forbidden key and the $n$ given patterns if we select the key optimally.
4 1 4 0000 1000 1100 1010 1000
5
2 4 4 0000 0000 0000 1000 0100 0010
2