|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||49||8||8||16.327%|
Long long ago in a far far away land there were two great cities and The Great Caravan Road between them. Many robber gangs “worked” on that road.
By an old custom the i-th band robbed all merchants that dared to travel between ai and bi miles of The Great Caravan Road. The custom was old, but a clever one, as there were no two distinct i and j such that ai ≤ aj and bj ≤ bi. Still when intervals controlled by two gangs intersected, bloody fights erupted occasionally. Gang leaders decided to end those wars. They decided to assign each gang a new interval such that all new intervals do not intersect (to avoid bloodshed), for each gang their new interval is subinterval of the old one (to respect the old custom), and all new intervals are of equal length (to keep things fair).
You are hired to compute the maximal possible length of an interval that each gang would control after redistribution.
The first line contains n (1 ≤ n ≤ 100 000) — the number of gangs. Each of the next n lines contains information about one of the gangs — two integer numbers ai and bi (0 ≤ ai < bi ≤ 1 000 000). Data provided in the input file conforms to the conditions laid out in the problem statement.
Output the maximal possible length of an interval in miles as an irreducible fraction p/q.
3 2 6 1 4 8 12
In the above example, one possible set of new intervals that each gang would control after redistribution is given below.