I have submitted my solution to question MNMX and it's only 60% correct.Why?

I have solved this problem by taking dynamic array and then sorting the array and multiplying element at 0 position with size-1 and i think this is the correct answer but my Solution is only Partialy correct.Can you correct me?
https://www.codechef.com/viewsolution/27385312
My solution link.

Just replace all int to long long int inside main you will get AC(100%).

1 Like