Logo
(追記) (追記ここまで)

33266번 - Generate Optimal Key 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB111100.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.

제한

예제 입력 1

4 1 4
0000
1000
1100
1010
1000

예제 출력 1

5

예제 입력 2

2 4 4
0000
0000
0000
1000
0100
0010

예제 출력 2

2

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 3: THird roUnd G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /