Can somebody please tell me why I am getting wrong answer in problem “Ups and downs ANUUND” which is in the practice(easy)?

I have applied same logic as in the explanation,but instead of changing array A to array B,I am just printing the elements of array A in swapped form.i.e. except first and last element I am printing every pair of elememnts ((a[1],a[2]),(a[3],a[4])) in swapped form. If this logic is wrong can you just give me a test case for which this logic is wrong.

My soln.is given below:

http://www.codechef.com/viewsolution/3957175

try this test case:

input:

1

6

1 4 2 3 6 7

your output: 1 7 7 7 7 7

correct output: 1 3 2 6 4 7

1 Like