This page is still under construction.

Parts of this page are still being built. What you see may change.

Highway of the Future

Time limit10sMemory limit128 MB

Summary
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.
Level

Hard8 of 10

Topics
Geometry, Sorting, Hash map, Math
Solved
No attempts yet

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 t1t_1 can sit in a different lane at time t2t_2, as long as t1≠t2t_1 \ne t_2.

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 tt at which the car enters the highway, and the speed vv at which it travels along it.

The highway is 100100 length units long. In one time unit a quantum car moving at speed vv travels exactly vv 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 nn (1≤n≤350001 \le n \le 35000), the number of quantum cars that will travel along the highway.
  • nn lines with two integers:
    • tit_i: the time at which quantum car ii enters the highway (1≤ti≤100001 \le t_i \le 10000)
    • viv_i: the speed of quantum car ii (1≤vi≤1001 \le v_i \le 100)

Output

For each test case, print one line with one integer: the least number of lanes required so that no collision happens.

Examples1

  1. Example 1

    Input
    3
    15 20
    19 100
    10 10
    3
    10 20
    10 10
    10 30
    2
    10 10
    10 10
    2
    10 1
    20 100
    
    Expected output
    3
    3
    2
    2