#arc129b. [arc129_b]Range Point Distance
[arc129_b]Range Point Distance
Problem Statement
For integers , , and (), let us define as follows.
- If :
- If :
- If :
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.
Sample Input 1
3
1 3
2 4
5 6
Sample Output 1
0
0
1
- For , an optimal choice is .
- For , an optimal choice is .
- For , an optimal choice is .
Sample Input 2
10
64 96
30 78
52 61
18 28
9 34
42 86
11 49
1 79
13 59
70 95
Sample Output 2
0
0
2
18
18
18
18
18
18
21