In a programming contest, a participant’s position is determined by 2 things. His score, , and his penalty, . The participant with the higher score will be ahead of the participant with a lower score. If scores are the same then, the participant with less penalty gets ahead of the other participant. No Two participants can have the same score and penalty at a time. Participants’ scores and penalties will be given in sorted order. You will be given a position, and you have to find out the minimum score and maximum penalty to get that exact position. Note that, the score can be up to and penalty can be up to and both score and penalty are non-negative integer numbers.
The first line will contain two integer and where is the number of participants and is the desired position.
In the next lines, you will be given two integers , where is the score and is the penalty.
You have to Print two integer values the minimum score and maximum penalty to get that exact position. If that exact position is not possible, print .
5 2 460 8 460 14 360 120 330 45 250 10
5 4 1370 77 1250 80 1140 6 1140 7 780 120
Login to submit
As you have to minimize the score and maximize the penalty, you have to try to keep the score same a...