eolymp
bolt
Try our new interface for solving problems
Problems

Tourist

Tourist

Tourist walks along the \textbf{X} axis. He can choose either of two directions and any speed not exceeding \textbf{V}. He can also stand without moving anywhere. He knows from newspapers that at time \textbf{t_1} in the point with coordinate \textbf{x_1} in interesting event will occur, at time \textbf{t_2} in the point with coordinate \textbf{x_2} - another one, and so on up to (\textbf{x_n}, \textbf{t_n}). Interesting events are short so we can assume they are immediate. Event \textbf{i} counts visited if at time \textbf{t_i} tourist was at point with coordinate \textbf{x_i}. Write program tourist that will find maximum number of events tourist if: \begin{itemize} \item at the beginning (when time is equal to \textbf{0}) tourist appears at point \textbf{0}, \item tourist can choose initial point for himself. \end{itemize} Yes, you should answer on two similar but different questions. \InputFile The first line contains single integer number \textbf{N }(\textbf{1 }≤ \textbf{N }≤ \textbf{100 000}) - number of interesting events. The following \textbf{N }lines contain two integers \textbf{x_i} and \textbf{t_i} - coordinate and time of the \textbf{i}-th event. The last line of the input contains integer \textbf{V} - maximum speed of the tourist. All \textbf{x_i} will be within range \textbf{-10^8} ≤ \textbf{x}\textit{\textbf{_i}} ≤ \textbf{10^8}, all \textbf{t_i} will be between \textbf{1} ≤ \textbf{t}\textit{\textbf{_i}} ≤ \textbf{10^6} inclusive. \textbf{V} will be positive and will not exceed \textbf{1000}. The input may contain events that happen at the same time or in the same place but not in the same place at the same time. \OutputFile The only line should contain two space-sepatated integers - maximum number of events tourist can visit in he starts moving from point \textbf{0} at time \textbf{0}, and maximum number of events tourist can visit if he chooses the initial point for himself.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
-1 1
42 7
40 8
2
Output example #1
1 2

Example description: Выйдя в момент 0 из точки 0, турист может успеть только на первое событие. Выйдя из точки 42, турист может посетить второе и третье события.

Author Ilya Porublev
Source 2011 XXIV All-Ukrainian Informatics Olympiad, Cherkasy, March 26 - 31, Round 1