DMOPC '14 Contest 6 P2 - Longest Tunnel

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

Simon likes drilling tunnels parallel to the ground. Simon has drilled N horizontal line tunnels. Each tunnel t starts from X_{t_1} and ends at X_{t_2}. What is the length of the longest tunnel that Simon has dug?

Input Specification

The first line of input will contain the single integer N (1 \le N \le 500) .
For each of the next N lines, line t will contain two space-separated integer values X_{t_1} and X_{t_2} (0 \le X_{t_1} < X_{t_2} \le 10^9).

Output Specification

On one line, the length of the longest tunnel.

Sample Input

1 8
9 150
0 81

Sample Output



There are no comments at the moment.