#P5086. Beautiful Coordinates
Beautiful Coordinates
Beautiful Coordinates
You are given N coordinates. For the ith coordinate with parameters \(X_i, Y_i, Z_i, Q_i\) and the jth coordinate with parameters \(X_j, Y_j, Z_j, Q_j\), if they satisfy
\[ X_i - X_j = Y_i - Y_j = Z_i - Z_j = Q_i - Q_j, \]
then the pair of coordinates is called a beautiful coordinate pair.
Your task is to determine, among all beautiful coordinate pairs (with \(i < j\)), the minimum value of \(j-i\) and the maximum value of \(i+j\).
Note: The index of the coordinates is 1-indexed according to their input order.
inputFormat
The first line contains an integer \(N\) \( (N \geq 2)\) representing the number of coordinates.
Each of the following \(N\) lines contains four space-separated integers \(X_i\), \(Y_i\), \(Z_i\), and \(Q_i\) representing the parameters of the ith coordinate.
outputFormat
Output two space-separated integers: the minimum value of \(j-i\) and the maximum value of \(i+j\) among all beautiful coordinate pairs.
sample
4
1 2 3 4
2 3 4 5
1 1 1 1
2 2 2 2
1 7