Array cost Test Case

Code - https://ide.codingblocks.com/s/38867
Quest - https://hack.codingblocks.com/contests/c/512/270
One test case is not passing code is working perfectly in my CB ide.

Hey Mukul, check the constraints given in the ques an element can be of range 10^9 but you are taking an int array. Also, try to reduce the time complexity of your code.

Hey, It didn’t work either, for long long datatype for array.

Try to reduce your code’s time complexity also…now its O(N^2).