luogu#P4795. [BalticOI 2018] 基因工程

    ID: 3819 远端评测题 2000ms 750MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2018进制构造BalticOI(波罗的海)

[BalticOI 2018] 基因工程

Problem Description

This problem is translated from BalticOI 2018 Day 2 “Genetics”.

You are given NN strings of length MM, consisting only of A, T, G, and C, numbered 1N1 \ldots N. One of them is the pattern string. Each of the other N1N - 1 strings differs from the pattern string in exactly KK characters. Find this pattern string.

Input Format

The first line contains three integers NN, MM, and KK, satisfying 1KM1\leqslant K\leqslant M.

The next NN lines each contain a string of length MM.

It is guaranteed that the pattern string exists.

Warning: The I/O size of this problem is large. For Java or Python, please use faster I/O methods.

Output Format

Output one integer, the index of the pattern string.

4 3 1
ACC
CCA
ACA
AAA
3
4 4 3
CATT
CAAA
ATGA
TCTA
4

Hint

Translated by ChatGPT 5