Highway of the Future
Time limit10sMemory limit128 MB
Given each car entry time and speed, compute the largest number of cars at the same spot at the same time on a 100-unit highway.
Problem
The year is 23413 and the quantum road authority (QRA) needs your help designing a new quantum highway. The biggest difference between a quantum highway and a regular highway is that quantum cars switch lanes instantly. A quantum car that sits in one lane at time can sit in a different lane at time , as long as .
In 23413 the future prediction authority (FPA) knows exactly who will use the new highway. For every quantum car that will travel along the highway, the FPA gives you two values: the time at which the car enters the highway, and the speed at which it travels along it.
The highway is length units long. In one time unit a quantum car moving at speed travels exactly length units. The size of a quantum car is negligible compared with the length of the highway, so treat a car as a point.
Your job is to make sure no collision happens on the highway. Quantum cars carry very sophisticated collision prevention gear, so as long as the highway has enough lanes, cars magically switch lanes to avoid each other. A collision happens when, at some time, the number of cars at one position along the highway is larger than the number of lanes. Such a collision can happen even at the exact start or the exact end of the highway.
What is the least number of lanes required so that no collision happens?
Input
The input holds several test cases and continues until end of file. Each test case has this form:
- One line with one integer (), the number of quantum cars that will travel along the highway.
- lines with two integers:
- : the time at which quantum car enters the highway ()
- : the speed of quantum car ()
Output
For each test case, print one line with one integer: the least number of lanes required so that no collision happens.