TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given n points with integer coordinates in 3-D cartesian space, find the maxmimum distance between any pair of them.


Note that here "distance" is defined as the manhatton distance, that is, the sum of absolute difference of each x/y/z coordinate between a pair of point.

Input Format

There are multiple testcase, input is terminated by EOF.
Each testcase starts with an integer N (2<=N<=100000), denoting the number of points in space. The following N lines each contain a triple of integers that represents the (x,y,z) coordinate of a point. 0 <= |xi|, |yi| |zi| <= 107.

Output Format

For each testcase output a number in a single line indicating the maximum manhatton distance between all possible pairs.

Sample Input 1

3
1 2 3
0 -3 2
5 4 1

Sample Output 1

13

Hints

Problem Source

Migrated from old NTUJ.

uva11012

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 65536 200