#P13810. [CERC 2022] Differences

[CERC 2022] Differences

题目描述

We have a list of NN strings SiS_i. All strings have length MM and consist only of characters A, B, C and D. Let us define the distance between two strings XX and YY as the number of indices jj, where the strings have different characters (XjYjX_j \neq Y_j). We know that the list of strings SiS_i contains precisely one special string that has distance KK to all other strings. Note that there might be other pairs of strings with a distance of KK. We are experiencing problems finding this special string, so please write a program to help us out.

输入格式

The first line contains space-separated integers NN, MM and KK. Strings SiS_i are given in the following NN lines.

输出格式

Output the index ii of the special string. Strings are numbered from 1 to NN as given in the input.

5 10 2
DCDDDCCADA
ACADDCCADA
DBADDCCBDC
DBADDCCADA
ABADDCCADC
4
4 6 5
AABAAA
BAABBB
ABAAAA
ABBAAB
2

提示

Input limits

  • 2N,M1052 \leq N, M \leq 10^5
  • 1KM1 \leq K \leq M
  • NM2107NM \leq 2 \cdot 10^7