#K72332. Find the Quickest Truck

    ID: 33730 Type: Default 1000ms 256MiB

Find the Quickest Truck

Find the Quickest Truck

You are given a number of delivery points N along with two lists of timestamps. The first list corresponds to Truck 1 and the second list to Truck 2. Each list contains N integer timestamps corresponding to the time at which a truck reached each delivery point. Your task is to compute the minimum time difference between any two consecutive delivery points for each truck. Then, determine which truck has the fastest (smallest) such time gap. In case both trucks have the same minimum time gap, print "Tie" along with that gap.

Formally, if we denote the timestamps for Truck 1 as \(a_1, a_2, \dots, a_N\) and for Truck 2 as \(b_1, b_2, \dots, b_N\), we need to find

[ \text{minDiff1} = \min_{2 \le i \le N} (|a_i - a_{i-1}|) \quad \text{and} \quad \text{minDiff2} = \min_{2 \le i \le N} (|b_i - b_{i-1}|). ]

Then, if \(\text{minDiff1} < \text{minDiff2}\), output "Truck 1" and \(\text{minDiff1}\). If \(\text{minDiff2} < \text{minDiff1}\), output "Truck 2" and \(\text{minDiff2}\). Otherwise, output "Tie" and the common minimum value.

inputFormat

The first line contains an integer N - the number of delivery points.

The second line contains N space-separated integers representing the timestamps for Truck 1.

The third line contains N space-separated integers representing the timestamps for Truck 2.

outputFormat

Output a single line containing the identifier of the truck with the smallest consecutive time gap and the gap value. The two values should be separated by a space. If both trucks have the same minimum gap, output "Tie" followed by the gap value.

## sample
4
0 5 9 15
0 7 14 30
Truck 1 4