跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F0901. Tourist

  • ID: 907
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:挑战
  • 上传者:
  • 二分
  • 数据结构
  • 动态规划
  • 算法思想
  • 挑战
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Tourist

题目描述

F. Tourist
time limit per test
0.5 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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 t1 in the point with coordinate x1 an interesting event will occur, at time t2 in the point with coordinate x2 − another one, and so on up to (xn,tn). Interesting events are short so we can assume they are immediate. Event i counts visited if at time ti tourist was at point with coordinate xi.

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.

Input

The first line of input contains single integer number N (1≤N≤100000) − number of interesting events. The following N lines contain two integers xi and ti − coordinate and time of the i-th event. The last line of the input contains integer V − maximum speed of the tourist. All xi will be within range -2·108≤xi≤2·108, all ti will be between 1 and 2·106 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.

Output

The only line of the output 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.

Examples
Input
3
-1 1
42 7
40 8
2
Output
1 2

题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 335 题。保留原作者与原赛事署名。