프로그램 명: coci_znan
제한시간: 1 초
[문제 요약] R 행 C 열이 주어진다. 각 성분은 소문자 알파벳이고 어떤 두 렬도 같지 않다.
어 떤 두 렬도 같아서는 안되는 조건 하에 가장 많은 행을 지울 수 있는 행 수를 구하는게 문제이다.
단 , 위의 행 부터 차례대로 지워야 한다.
In this economy, we all know how hard it is to get a job. Mirko, a recent college graduate, however, got
lucky - he is now employed as a runeologist by the Language Institute of Croatia. His friend Slavko
believes runeology isn’t a science and is hence angry at Mirko for believing the opposite. One foggy
Christmas day, Mirko’s laptop broke. Since he isn’t great with computers, he gave it to Slavko to repair
it. Slavko, felling a little naughty, decided to mess up a particular file Mirko was working on.
This file contains a matrix of R rows and C columns. Each element of the matrix is a single letter. No
two columns of the matrix are equal. To have some fun with pseudo-scientist Mirko, Slavko decided
he will delete as much rows as possible from the top of the table, without breaking the no-equalcolumn
rule.
입력
The first line of input contains two integers R and C (2 ≤ R, C ≤ 1000), the number of rows and the
number of columns, respectively.
In each of the next R lines there are C small letters of the English alphabet. These R x C letters
represent Mirko’s table (which does not have two same columns).
출력
Output a single integer, the maximum number of rows which can be deleted from the top of the table
so that no two columns are equal.
입출력 예
입력
2 6
dobarz
adatak
출력
0
입력
3 4
alfa
beta
zeta
출력
2
입력
4 6
mrvica
mrvica
marica
mateja
출력
1
출처:coci 2010
[질/답]
[제출 현황]
[푼 후(0)]