eolymp
bolt
Try our new interface for solving problems
Problems

Hiring

Hiring

You have to hire workers for a construction project. There are $n$ candidates applying for the job, numbered from $1$ to $n$ inclusive. Each candidate $k$ requires that if he is hired, he must be paid at least $S_k$ dollars. Also, each candidate $k$ has a qualification level $Q_k$. The regulations of the construction industry require that you pay your workers in proportion to their qualification level, relative to each other. For example, if you hire two workers $A$ and $B$, and $Q_A = 3 * Q_B$, then you have to pay worker $A$ exactly three times as much as you pay worker $B$. You are allowed to pay your workers non-integer amounts of money. This even includes quantities that cannot be written with a finite number of digits in decimal form, such as a third or a sixth of a dollar. You have $w$ dollars at hand and you want to hire as many workers as possible. You decide whom to hire and how much to pay them, but you have to meet the minimum salary requirements of those you choose to hire, and you have to obey the industry regulations. You also have to fit within your budget of $w$ dollars. The nature of your project is such that the qualification level is completely irrelevant, so you are only interested in maximizing the number of workers without regard to their qualification level. However, if there is more than one way to achieve this, then you want to select the one where the total amount of money you have to pay your workers is as small as possible. In case there is more than one way to achieve this, then you are indifferent among these ways and you would be satisfied with any one of them. Write a program that, given the different salary requirements and qualification levels of the candidates, as well as the amount of money you have, determines which candidates you should hire. You must hire as many of them as possible and you must do so with as little money as possible, while complying with the industry regulations specified above. \InputFile The first line contains the integers $n$ $(1 ≤ n ≤ 500 000)$ and $w$ $(1 ≤ w ≤ 10^{10})$, separated by a space. The next $n$ lines describe the candidates, one candidate per line. The $k$-th of these lines describes candidate number $k$ and it contains the integers $S_k$ and $Q_k$ ($1 ≤ S_k, Q_k ≤ 20 000$), separated by a space. \OutputFile The first line must contain a single integer $h$, the number of workers that you hire. The next $h$ lines must list the identifying numbers of the candidates you choose to hire (each of them a different number between $1$ and $n$), one per line, in any order.
Time limit 5 seconds
Memory limit 64 MiB
Input example #1
4 100
5 1000
10 100
8 10
20 1
Output example #1
2
2
3