There are 4 arrays of A, B, C, D of size N, we have to find ↵
max( | A[i]-A[j] | + | B[i]-B[j] | + | C[i]-C[j] | + | D[i]-D[j] | + | i-j |) where 1<=i<j<=n ; 1<N<=10^5↵
↵
↵
sample input : ↵
5 ↵
5 7 6 3 9 ↵
7 9 2 7 5 ↵
1 9 9 3 3 ↵
8 4 1 10 5 ↵
↵
sample output :↵
24↵
max( | A[i]-A[j] | + | B[i]-B[j] | + | C[i]-C[j] | + | D[i]-D[j] | + | i-j |) where 1<=i<j<=n ; 1<N<=10^5↵
↵
↵
sample input : ↵
5 ↵
5 7 6 3 9 ↵
7 9 2 7 5 ↵
1 9 9 3 3 ↵
8 4 1 10 5 ↵
↵
sample output :↵
24↵