책상 두 개를 선택해서 사이(선택한 책상 포함)에 있는 책상에 앉은 학생 중 한 학생의 점수를 조사할 때 같은 점수로 연결되어 있어야 한다. 선택할 수 있는 가장 많은 책상 수와 그 때의 점수를 출력하는게 문제.
Each student has studied art, but only to a certain level. The old professor can tell by the looks on their faces just how much they have studied. The professor, being an artist, uses a different coloured pencil for each grade. Unfortunately, today he brought only one pencil.
In order to make the examination seem fair, he wants to choose two desks and question one student from each desk positioned between the two desks he has chosen (including the chosen desks). It is important that all examined students deserve the same grades, so he can write them down using his only pencil.
The professor wants to know the maximum number of students he can examine this way, as well as which grade the students will get.
입력 1 1 5 출력 1 1 입력 3 3 5 4 5 1 3 출력 2 5 입력 4 2 1 3 2 5 3 2 5 출력 2 2
출처:coci 2010