ANUUND - Editorial

http://www.codechef.com/viewsolution/3922782 Can someone please tell me where I went wrong ?
Thanks in advance.

Please tell me why I am getting WA?
http://www.codechef.com/viewsolution/3943506

Can somebody please tell me why I am getting wrong answer?
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

I donā€™t know why am i getting wrong answer for my code ā€¦seems to work fineā€¦any kind of help will be appreciated ā€¦thanks

t=int(input())

while t>0:

    size=int(input())
    array=[int(i) for i in input().split()]
    array2=array
    array2.sort()

    i=1
    for i in range(i,len(array),2):
         if i==len(array2)or i==len(array2)-1:
            break

         else:
           j=i+1
           a=array2[i]
           array2[i]=array2[j]
           array2[j]=a
    print(array2)
    t-=1

can anyone help me out. Its working for all test cases still getting wrong answer.
2 approaches
http://www.codechef.com/viewsolution/6464869
http://www.codechef.com/viewsolution/6464697

In O(N) solution take A = {4,3,5,1,9}.
You will get wrong answer.

My Answer :
Sort the array.
print the first element , n den swap the next two
So, if input is,
5 4 3 2 1
it will sort: 1 2 3 4 5
n output will b like
1 3 2 5 4
Whats wrong in this?

https://www.codechef.com/viewsolution/9114451
how can i remove the TLE? please help!

as you have said
ā€œA now becomes = [1, 3, 4, 5].
Our array B will be [1, 5, 3, 4].ā€

but the solution of A = [1, 3, 4, 5] can also be [ 1 , 4 ,3 ,5] . This is also satisfying your condition. isnā€™t it ???