eolymp
bolt
Try our new interface for solving problems
Problems

K Best

K Best

Demy has \textbf{n} jewels. Each of her jewels has some value \textbf{v_i} and weight \textbf{w_i}. Since her husband John got broke after recent financial crises, Demy has decided to sell some jewels. She has decided that she would keep \textbf{k} best jewels for herself. She decided to keep such jewels that their specific value is as large as possible. That is, denote the specific value of some set of jewels \textbf{S = \{i_1, i_2, ..., i_k\}} as \includegraphics{https://static.e-olymp.com/content/46/4635ff5c515dc5ee3e14dc6c150a10424008b500.jpg} Demy would like to select such \textbf{k} jewels that their specific value is maximal possible. Help her to do so. \InputFile The first line of the input file contains \textbf{n} - the number of jewels Demy got, and \textbf{k} - the number of jewels she would like to keep (\textbf{1} ≤ \textbf{k} ≤ \textbf{n} ≤ \textbf{100000}). The following \textbf{n} lines contain two integer numbers each - \textbf{v_i} and \textbf{w_i} (\textbf{0} ≤ \textbf{v_i} ≤ \textbf{10^6},\textbf{1} ≤ \textbf{w_i} ≤ \textbf{10^6}, both the sum of all \textbf{v_i} and the sum of all \textbf{w_i} do not exceed \textbf{10^7}). \OutputFile Output \textbf{k} numbers - the numbers of jewels Demy must keep. If there are several solutions, output any one.
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
3 2
1 1
1 2
1 3
Output example #1
1
2