I :: Intervals
Time Limit: 2 Seconds Memory Limit: 32768 KB
There are a lot of lamps in Mollasadra street. Each lamp has a height h and a coordinate x. Babak wants to find the interval (x1, x2) with the maximum lightness (excluding x1 and x2). An interval has a more lightness if there are more lamps to lighten it. Each lamp lightens a symmetric range around x as long as h/2 from each side. You need to find the number of the intervals with the maximum lightness.
Input
There are multiple test cases. Each one begins with an integer n≤1000 as the number of lamps followed by n lines. The ith line contains two integers xi and hi denotes coordinate and height of ith lamp (absolute value of each integer is less than 109 and hi>0 is even for each i).
Output
For each test case, print two integers. The number of intervals with the maximum lightness and the number of lamps lighten each one.
Sample Input
2 2 4 3 6 3 1 2 2 4 3 2
Sample Output
1 2 2 2Submit
Source: 12th Iran Nationwide Internet Contest IV