11054 - Wine trading in Gergovia
Solution Description : Ad hoc problem Exmple: Input : 5 -4 1 -3 1 Positive Sum : 5 5 6 6 7 -> Running Positive sum Negative Sum : 0 4 4 7 7 -> Running Negative sum Absolute Diff : 5 1 2 1 0 -> Absolute difference between positive sum and negative sum Sum of absolute diff: 5+1+2+1+0=9 So, ans is 9 Remember that use long long for Positive sum, Negative sum and Sum of absolute difference. |
||||||||||