DWITE, January 2012, Problem 5
Comets have recently passed through your region of space, leaving behind a trail of dust. You would like to get a rough idea of the extent of this pollution, by finding the two most distant dust particles. Here, we define distance as the sum of differences between the
There are
For example, consider a comet described by
Pay close attention to the bounds. You may assume that there will be fewer than
The input will contain 5 test cases. Each will begin with a single integer
The output will contain 5 lines of output, one integer for each test case: the distance between the most distant pair of dust particles. There will be at least 2 dust particles.
Sample Input
1
1 0 0 0 -2 1 0 0 6 1 5
3
3 1 4 1 5 9 2 6 5 3 58
2 7 1 8 2 8 1 8 2 8 45
1 6 1 8 0 3 3 9 8 8 74
Sample Output
32
66726
Problem Resource: DWITE
Comments