Help please

Revision en5, by liveoverflow, 2020-05-31 10:33:44

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; 1<=A[i],B[i],C[i],D[i]<=10^9

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

Tags #dynamic programing, #help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English liveoverflow 2020-05-31 10:33:44 37 Tiny change: 'o find \n max( | A[i' -> 'o find \nmax( | A[i'
en4 English liveoverflow 2020-05-31 10:08:53 12 Tiny change: 'e input : \n5 \n5 ' -> 'e input : \n5 \n5 '
en3 English liveoverflow 2020-05-31 10:05:16 94
en2 English liveoverflow 2020-05-31 09:55:54 16
en1 English liveoverflow 2020-05-31 09:54:52 170 Initial revision (published)