WA in Ups and Downs may cook off

http://www.codechef.com/viewsolution/3922340 . Plz tell me what is wrong with this soon. Thnx in advance

you are not scanning test cases. just scan test cases and upload it. it will work.
Your program takes O(nlogn) time, this can be done in O(n).
Go from A[1] to A[N] in left to right order, if at any point of time, condition of given inequalities are not satisfied, then swap the elements in such a way that the condition is satisfied

1 Like

Thanks for answer

//