SP32567 MEETSHIP - First to meet the spaceship

Description

A spaceship has been sighted heading towards Earth. For the entire time that humanity has been monitoring it, it has not altered its course, it only changed speed for unknown reasons. As such, all the possible places on Earth where the spaceship might end up landing form a straight line; depending on how much it changes speed, it will land at different times, meaning a different point on this line due to Earth's rotation. **n** people want to be the first to meet the aliens - they picked a point **x** $ _{i } $ on this line and wait at that point in their vehicle with speed **v $ _{i} $** . Now they are all anxiously waiting for the spaceship's arrival. NASA has given a list of **q** most likely locations where the spaceship might end up landing - and everyone wants to know who would get to be the first to meet the aliens if the spaceship landed at each of the given points. They turned to you for help!

Input Format

The first line contains two integers **1 - the number of people wishing to meet the aliens and the number of possible points where the spaceship might land.** The following **n** lines contain two integers **0 and **0 < v $ _{i} $ - the point on the line where the **i**-th person is waiting and the speed of his vehicle. Additionally, **x $ _{i} $** **= x** $ _{j} $ **→ v** $ _{i} $ **≠ v** $ _{j} $ .**** The last line contains **q** distinct integers **0 - the points on the line where the spaceship might end up landing. You may assume the spaceship will not land at any point containing a person waiting in a vehicle.**

Output Format

For each query **q $ _{i } $** output the number of people who will arrive at the spaceship first if it lands at that point. A person at **x** $ _{j} $ with speed **v** $ _{j} $ will arrive at **q $ _{i} $** in time **|****x** $ _{j} $ **- q** $ _{i} $ **| /** **v** $ _{j} $ . The people who will arrive at the spaceship first are those **j** for whom the fraction is minimal out of all people. Then, in the same line, output the 1-based indices of these people as they were given in the input, sorted in ascending order.