CCC '96 S5 - Maximum Distance
View as PDFConsider two descending sequences of integers  and 
 with 
 and 
 and for all 
, 
. The distance between two elements 
 and 
 is given by
The distance between sequence  and sequence 
 is defined by
You may assume .
For example, for the sequences  and 
 below, their maximum distance is reached for 
 and 
, so 
.
           i=2
            |
            v
X     8  8  4  4  4  3  3  3  1
Y     9  9  8  8  6  5  5  4  3
                           ^
                           |
                          j=7
Input Specification
The first sequence is the  sequence and the second is the 
 sequence. You may assume that the sequences are descending and of equal length. A pair of sequences is preceded by a number on a single line indicating the number of elements in the sequences. Numbers in a sequence are separated by a space, and each sequence is on a single line by itself. As usual, the first number in the input gives the number of test cases.
Sample Input
2
9
8 8 4 4 4 3 3 3 1
9 9 8 8 6 5 5 4 3
7
6 5 4 4 4 4 4
3 3 3 3 3 3 3
Sample Output
The maximum distance is 5
The maximum distance is 0
Comments
Nevermind, forget this Question
What do i have to output, when the input is
Don't assume that all the numbers will be single digits, I did that for some reason
WAYYY TOO HARDDD!!!!
The additional test case from WCIPEG has been added, worth 90% of points and all submissions have been rejudged.
For anyone who doesn't understand this problem, you have to basically find the maximum distance between two values in the arrays given
ntimes.On line 1, there is a single integer
n.l.lintegers.Repeat steps 1 & 2
ntimes.Hope this helps you understand the problem a bit better.