Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
In a programming contest, a participant’s position is determined by 2 things. His score, $s$, and his penalty, $p$. 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, $k$ 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 $\textbf{2500}$ and penalty can be up to $\textbf{180}$ and both score and penalty are nonnegative integer numbers.
The first line will contain two integer $n(1 \le n \le 10^5)$ and $k$ $(1 \le k \le n)$ where $n$ is the number of participants and $k$ is the desired position.
In the next $n$ lines, you will be given two integers $s$, $p$ ${(0 \le s \le 2500, 0 \le p \le 180)}$ where $s$ is the score and $p$ is the penalty.
You have to Print two integer values $$ the minimum score ${(0 \le score \le 2500)}$ and maximum penalty ${(0 \le penalty \le 180)}$ to get that exact position. If that exact position is not possible, print $1$.
Input  Output 

5 2 460 8 460 14 360 120 330 45 250 10  460 13 
Input  Output 

5 4 1370 77 1250 80 1140 6 1140 7 780 120  1 
59% Solution Ratio
adnan_tokyEarliest,
sayeef006Fastest, 0.0s
Mizan18Lightest, 131 kB
YouKnowMEEMShortest, 489B
Login to submit
As you have to minimize the score and maximize the penalty, you have to try to keep the score same a...
Replay of CodeSpark 2021

CodeSpark 2021
