Author: | A. Baranov | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Let us consider 3-dimensional area that is split by uniform rectangular grid. Some cells contain ants. Each second every ant can either stay put or move to the neighboring cell in any of the six directions: up, down, right, left, forward and backward.
Your program must, given coordinates of starting cell for each ant, find minimum possible number of seconds (starting from zero) until any two ants meet in the same cell.
Input file contains integer N followed by N triples of integer indices Xi, Yi, Zi — coordinates of starting cells for each ant.
Output file must contain a single integer — minimal number of seconds until two ants meet.
−106≤(Xi,Yi,Zi)≤106, 2≤N≤5⋅104
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|