#P6502. [COCI 2010/2011 #3] ZNANSTVENIK
[COCI 2010/2011 #3] ZNANSTVENIK
Description
You are given an matrix of letters. Starting from the first row of this matrix, you need to delete as many rows as possible, while ensuring that no two columns in the matrix are identical. Output the maximum number of rows that can be deleted.
- Two columns are considered identical if, for every row, the letters in these two columns are the same.
- In the initial matrix, any two columns are different.
Input Format
The first line contains two integers .
The next lines each contain letters, describing the letter matrix.
It is guaranteed that all letters in the matrix are lowercase letters.
Output Format
Output one integer on one line, representing the maximum number of rows that can be deleted.
2 6
dobarz
adatak
0
3 4
alfa
beta
zeta
2
4 6
mrvica
mrvica
marica
mateja
1
Hint
Constraints
For of the testdata, it is guaranteed that .
Notes
This problem is translated from COCI2010-2011 CONTEST #3 T4 ZNANSTVENIK。
Translated by ChatGPT 5
京公网安备 11011102002149号