Online Assesment -1 — Q1

Revision en1, by SD_1_2, 2021-10-24 16:58:38

Two Arrays A and B of length N , where N is even . There are two players kevin and paul. Total turns = N / 2 for each turn , Kevin picks two different unused index i and j paul picks either i or j , whichever value at index(i or j) of array B is maximum , if paul picks index i of Array B , then kevin picks j of Array A else if paul picks index j of Array B, then kevin picks i of Array A calculate sum of score of paul and sum of score of kevin for each turn find the maximum difference of their scores.

N-> Array size n sepated integers // Array A n separated integers // Array B

Ex input : N=2 1 1 1 1 Op: 0

N=4 4 2 8 6 6 5 7 8 Op : 4

N=6 7 8 2 6 10 3 9 1 3 10 2 4 Op: 8

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English SD_1_2 2021-10-24 16:58:38 732 Initial revision (published)