#C8980. Maximum Subsequence Score

    ID: 53022 Type: Default 1000ms 256MiB

Maximum Subsequence Score

Maximum Subsequence Score

You are given two arrays of integers, a and b, each containing n elements. A non-empty subsequence of an array is a sequence that can be derived by deleting zero or more elements without changing the order of the remaining elements. Note that even a single element is considered a valid subsequence.

The score for a pair of non-empty subsequences is defined as the maximum absolute difference between any element from the chosen subsequence of a and any element from the chosen subsequence of b. Formally, since any single element qualifies as a subsequence, the maximum score over all such pairs is given by:

max1i,jn  aibj\max_{1 \le i, j \le n} \; |a_i - b_j|

Your task is to compute and output this maximum score.

inputFormat

The input is given in the following format:

  1. The first line contains an integer n representing the number of elements in each array.
  2. The second line contains n space-separated integers, representing the array a.
  3. The third line contains n space-separated integers, representing the array b.

outputFormat

Output a single integer, which is the maximum score computed as the maximum absolute difference between any element of a and any element of b.

## sample
3
1 2 3
4 5 6
5