SD_1_2's blog

By SD_1_2, history, 3 years ago, In English

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

  • Vote: I like it
  • -34
  • Vote: I do not like it