eolymp
bolt
Try our new interface for solving problems

Tourist

Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB

Tourist walks along the X axis. He can choose either of two directions and any speed not exceeding V. He can also stand without moving anywhere. He knows from newspapers that at time t_1 in the point with coordinate x_1 in interesting event will occur, at time t_2 in the point with coordinate x_2 - another one, and so on up to (x_n, t_n). Interesting events are short so we can assume they are immediate. Event i counts visited if at time t_i tourist was at point with coordinate x_i.

Write program tourist that will find maximum number of events tourist if:

  • at the beginning (when time is equal to 0) tourist appears at point 0,

  • tourist can choose initial point for himself.

Yes, you should answer on two similar but different questions.

Giriş verilənləri

The first line contains single integer number N (1 N 100 000) - number of interesting events. The following N lines contain two integers x_i and t_i - coordinate and time of the i-th event. The last line of the input contains integer V - maximum speed of the tourist. All x_i will be within range -10^8x_i10^8, all t_i will be between 1t_i10^6 inclusive. V will be positive and will not exceed 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.

Çıxış verilənləri

The only line should contain two space-sepatated integers - maximum number of events tourist can visit in he starts moving from point 0 at time 0, and maximum number of events tourist can visit if he chooses the initial point for himself.

Nümunə

Giriş verilənləri #1
3
-1 1
42 7
40 8
2
Çıxış verilənləri #1
1 2
Müəllif Ilya Porublev
Mənbə 2011 XXIV All-Ukrainian Informatics Olympiad, Cherkasy, March 26 - 31, Round 1