Walking | 프로그래밍의 벗 PivotOJ
PivotOJ

Walking

시간 제한: 1000ms메모리 제한: 128MB출처: NOI 2012BOJ 9828

문제

Consider a road of length ℓ. There are n persons. The ith person, i = 1, . . . , n, will start walking from the beginning of the road at time ti and will move at a constant speed vi until arrival at the end of the road. We assume no two persons start walking at the same time, and no two persons arrive at the same time.

If the ith and jth person meet each other on the road, they will become friends. Mathematically, for the ith and jth persons where ti < tj, they will become friends if and only if ℓ/vi + ti > ℓ/vj + tj.

Your task is to find the size of the maximum set of persons who are friends of each other.

입력

Your program must read from the standard input. The input consists of n+1 lines. The first line contains two integers ℓ and n separated by space, where 100 ≤ ℓ ≤ 10000 and 1 ≤ n ≤ 500. Each of the next n lines contains two integers. For the (i+1)-th line, it contains the two integers ti and vi separated by space, where 0 ≤ ti ≤ 1000 and 1 ≤ vi ≤ 100.

출력

Your program must write to the standard output an integer which is the size of the maximum set of persons who are friends of each other.

예제

예제 1

입력
1000 4
1 3
2 1
0 2
3 4
출력
3

예제 2

입력
1000 4
0 1
2 1
1 1
3 1
출력
1
코드를 제출하려면 로그인하세요.