TADELIVE - Editorial

There is very loose test data in this problme.Because my submission got AC but actually my code is not correct in many cases.
https://www.codechef.com/viewsolution/24866074
this code produces wrong output.
example test case-
7 5 2
1 2 3 4 5 6 7
5 4 3 2 1 12 14
produced output->53
correct output->41

for all those who r getting 100% correct answers try this one:
5 1 4
1 1 1 1 1
5 5 5 5 6

the answer is 22.
hey @tuananh93 in my solution answer of the above test case gives 21 which is wrong but still, I got 100%.
So,plz check it.
also try it in this way:
5 1 4
1 1 1 1 1
6 5 5 5 5.