luogu#P5086. 坐标
坐标
Background
Solution write-up: https://blog.csdn.net/kkkksc03/article/details/84928342.
Xiaoben knows that Minecraft coordinates have three parameters: , , and . But in Xiaoben’s eyes, there is a fourth parameter , which represents how much he likes this location. For example, some places are Xiaoben’s home, so will be large; some places are dangerous mines, so will be small.
Problem Description
There are coordinates. For the -th coordinate with parameters and the -th coordinate with parameters , if $X _ i - X _ j = Y _ i - Y _ j = Z _ i - Z _ j = Q _ i - Q _ j$, then these coordinates are called beautiful coordinates.
Given coordinates, Xiaoben wants to know the minimum value of and the maximum value of among all beautiful coordinate pairs. Can you help him?
Input Format
The input has lines. The first line contains an integer . Then follow lines, each containing four integers , , , and .
Output Format
Output one line containing the minimum value of and the maximum value of , separated by a space. The testdata guarantees that a solution exists.
7
1 2 3 4
2 3 4 5
1 4 3 3
5 2 3 5
2 4 5 6
1 4 3 3
2 5 4 4
1 13
10
1 4 3 2
4 4 4 4
2 3 4 5
1 1 1 1
1 2 3 1
3 4 2 1
2 4 5 2
8 9 7 6
0 0 0 0
1 2 3 4
2 14
Hint
Explanation for Sample 1
and , or and , achieve the minimum value.
For and , is the maximum value.
Constraints
For of the data, .
For of the data, , and , , , are all within the int range.
Translated by ChatGPT 5