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

9895번 - Word 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB222100.000%

문제

Consider a set of k strings {S1, S2, . . . , Sk} where every character used in the k strings is either a space or any of the 26 characters in { ‘a’, ‘b’, ‘c’, . . ., ‘z’ }. For some constants l and d, our aim is to compute an (l, d)-pattern for {S1, S2, . . . , Sk}. An (l, d)-pattern is a length-l string W = W[1]W[2] . . . W[l] which satisfies the following property:

  • For every string Si (i = 1, 2, . . . , k), there exists a length-l substring X = X[1]X[2] . . . X[l] of Si such that the hamming distance of X and W is less than or equal to d. (The hamming distance of X and W is the number of pairs of (X[j], W[j]) such that X[j] ≠ W[j], for j = 1, 2, . . . , l.)

In this task, you are given numbers l and d and a set of strings; you need to compute an (l, d)-pattern for the given set of strings. You can assume that an (l, d)-pattern exists and is unique.

입력

The first line contains two integers l and d separated by a space, where 1 ≤ l ≤ 10 and 0 ≤ d ≤ 2. The second line contains the integer k, where 1 ≤ k ≤ 30. The remaining k lines contain the k strings S1, S2, . . . , Sk. (Each string is of length at most 50.)

출력

The output file contains a string of length l.

This string represents an (l, d)-pattern for the set of strings and l and d given in the input file. The input is always such that there exists exactly one (l, d) pattern.

제한

예제 입력 1

5 1
4
you have two applas
i am an ppple
we are acples
adples are good for health

예제 출력 1

apple

예제 입력 2

3 0
3
oil is expensive
we have three oilers
be more oily

예제 출력 2

oil

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > NOI 2005 6번

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

출처

대학교 대회

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

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