atcoder#ARC129B. [ARC129B] Range Point Distance
[ARC129B] Range Point Distance
Score : points
Problem Statement
For integers , , and (), let us define as follows.
- If dist(l,r,x)=l-x$
- If :
- If dist(l,r,x)=x-r$
You are given pairs of integers, the -th of which is . For each , solve the following problem.
- Let us choose an integer freely and compute $\max(dist(L_1,R_1,x),dist(L_2,R_2,x),\cdots,dist(L_k,R_k,x))$. Find the minimum possible value of this.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers for in this order.
3
1 3
2 4
5 6
0
0
1
- For , an optimal choice is .
- For , an optimal choice is .
- For , an optimal choice is .
10
64 96
30 78
52 61
18 28
9 34
42 86
11 49
1 79
13 59
70 95
0
0
2
18
18
18
18
18
18
21