IMO
시간 제한6초메모리 제한2048 MB
M개 문제와 최대 K점으로 구성된 N명의 점수가 주어질 때, 총점 순위가 유일하게 결정되도록 공개해야 하는 최소 점수 개수를 구한다.
문제
The International Mathematics Olympiad (IMO) is a maths competition for high school students that is held every year. The 2025 edition of the IMO takes place at the same time as the EGOI. As you are reading this, both contest days of the IMO have ended and the grading is probably almost done as well. Unlike programming competitions like the EGOI, the grading is done by hand, which is a long and arduous process.
This year the IMO had problems (numbered from to ), and each problem is worth a maximum of points. There were contestants taking part in the contest. The th contestant received a score of on problem , where is an integer between and , inclusive. The ranking of the contestants is determined by the total score of each contestant, with ties broken by the contestants' indices. More formally, contestant ranks higher than contestant if:
- either the total score of contestant is bigger than the total score of contestant ,
- or their total scores are the same and .
In order to release the final ranking, the organizers need to publish some of the values . If a value is unpublished, it is only known that it is an integer between and , inclusive.
The organizers want to reveal as few of the values as possible. At the same time, they need to make sure that everyone knows the correct final ranking. In other words, they must reveal a set of values such that the only ranking consistent with it is the correct one.
Find the smallest such that it is possible to reveal of the values in a way that uniquely determines the full ranking of the contestants.
입력
The first line contains three integers , , and : the number of contestants, the number of problems, and the maximum score of the tasks, respectively.
Then follow lines, where the th line contains . That is, the first of these contains , the second contains , and so on.
출력
Print one integer , the minimum number of scores that can be revealed so that the final ranking is uniquely determined.
제한
- .
- .
- .
- for every pair where and .