Problem:


Score : 300 points

Problem Statement

You are given an integer sequence of length n, a_1, ..., a_n.
Let us consider performing the following n operations on an empty sequence b.

The i-th operation is as follows:

Append a_i to the end of b.

Reverse the order of the elements in b.

Find the sequence b obtained after these n operations.

Constraints

1 \leq n \leq 2\times 10^5

0 \leq a_i \leq 10^9

n and a_i are integers.

Input

Input is given from Standard Input in the following format:

n
a_1 a_2 ... a_n

Output

Print n integers in a line with spaces in between.
The i-th integer should be b_i.

Sample Input 1

4
1 2 3 4

Sample Output 1

4 2 1 3

After step 1 of the first operation, b becomes: 1.

After step 2 of the first operation, b becomes: 1.

After step 1 of the second operation, b becomes: 1, 2.

After step 2 of the second operation, b becomes: 2, 1.

After step 1 of the third operation, b becomes: 2, 1, 3.

After step 2 of the third operation, b becomes: 3, 1, 2.

After step 1 of the fourth operation, b becomes: 3, 1, 2, 4.

After step 2 of the fourth operation, b becomes: 4, 2, 1, 3.

Thus, the answer is 4 2 1 3.

Sample Input 2

3
1 2 3

Sample Output 2

3 1 2

As shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.

Sample Input 3

1
1000000000

Sample Output 3

1000000000

Sample Input 4

6
0 6 7 6 7 0

Sample Output 4

0 6 6 0 7 7



Sample input:
4
1 2 3 4


Sample output:
4 2 1 3

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))

b = [0] * n

if n % 2 == 0 :
    c = n//2 - 1
else :
    c = n // 2

b[c] = a[0]

for i in range(1,n) :
    if i % 2 == 1 :
        b[c + i] = a[i]
        c += i
    else :
        b[c - i] = a[i]
        c -= i

if c != 0 :
    b.reverse()
    print(b)
else :
    print(b)

Submission status: Wrong Answer

Solution code:
from collections import deque
from typing import List


def main():
    n = int(input())
    v = input().split(" ")
    print(pp(n, v))


def pp(n: int, v: List[str]) -> List[str]:
    x = []
    y = deque([])

    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                y.append(v[i])
            else:
                x.append(v[i])
    else:
        for i in range(n):
            if i % 2 == 0:
                x.append(v[i])
            else:
                y.append(v[i])

    ret = []
    for i in range(len(x)):
        ret.append(x.pop())

    for i in range(len(y)):
        ret.append(y.popleft())

    return ret


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = l[::-2]
if n % 2 == 0:
  a.append(l[0::2])
else:
  a.append(l[1::2])
print(*a)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = l[n-1::-2]
if n % 2 == 0:
  a.append(l[0::2])
else:
  a.append(l[1::2])
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = l[::-2]
if n % 2 == 0:
  a.append(l[0::2])
else:
  a.append(l[1::2])
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = []
if n % 2 == 0:
  a = l[::-2]+l[0::2]
else:
  a = l[::-2]+l[1::2]
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []

for i in range(n):
  b.append(a[i])
  b = b[::-1]
print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = ""

if n%2 == 0:
  for i in range(0,n,2):
    b = b + str(a[i])
    b = str(a[i+1]) + b
else:
  for i in range(0,n-1,2):
    b = str(a[i]) + b
    b = b + str(a[i+1])
  b = str(a[n-1]) + b

print(" ".join(b))

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))

al=[l[len(l)-1]]

l=l[0:len(l)-1]

if n%2==0:
  al=al+l[1::2]+l[0::2]
else:
  al=al+l[0::2]+l[1::2]

print(*al)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))

al=[]

for i in l:
  al.append(i)
  al=al[::-1]
  
print(al)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))

al=[]

for i in l:
  al.append(i)
  al[::-1]
  
print(al)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(str,input().split()))
b=list()
cnt=0
for i in a:
    if cnt==0:
        b.append(i)
        cnt=1
    else:
        b.insert(0,i)
        cnt=0
#L=[str(a) for a in b]
b=" ".join(b)
print(b)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list()
cnt=0
for i in a:
    if cnt==0:
        b.append(i)
        cnt=1
    else:
        b.insert(0,i)
        cnt=0
L=[str(a) for a in b]
L=" ".join(L)
print(L)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split()

B = []
for i in range(N-1, -1, -2):
  B.append(A[i])

for j in range(0, N, 2):
  B.append(A[j])

print(" ".join(B))

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
b=[]
cnt=0
cnt_n=n-1
for i in range(n):
    if i%2==0:
        b.insert(cnt,A.pop())
        cnt+=1
    else:
        b.insert(cnt_n,A.pop())
        cnt_n-=1
print(*b)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(input().split())
b=""
for i in range(n):
    if n%2==0:
        if i%2==0:
            b=b+str(a[i])
        else:
            b=str(a[i])+b
    else:
        if i%2==0:
            b=str(a[i])+b
        else:
            b=b+str(a[i])
print(" ".join(b))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(str,input().split()))
b,c=[],[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            c.append(a[i])
    c.reverse()
    print(" ".join(b+c))
else:
    for i in range(n):
        if i%2==1:
            b.append(a[i])
        else:
            c.append(a[i])
    c.reverse()
    print(" ".join(c+b))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(str,input().split()))
b,c=[],[]
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        c.append(a[i])
c.reverse()
print(" ".join(c+b))

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
a = list(input().split())
q = deque()
for i in range(n):
    if n&1:
        if i&1:
            q.append(a[i])
        else:
            q.appendleft(a[i])
    else:
        if i&1:
            q.appendleft(a[i])
        else:
            q.append(a[i])
print("".join(list(q)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)//2
else:
  k = n//2
for i in range(n):
  if(i%2==0):
    b[k+ ((-1)**n%2)*i//2]=a[i]
  else:
    b[k-((-1)**n%2)*(i+1)//2]=a[i]
ans = ""
for i in range(n):
  ans += str(b[i])+" "
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)//2
else:
  k = n//2
for i in range(n):
  if(i%2==0):
    b[k+i//2]=a[i]
  else:
    b[k-(i+1)//2]=a[i]
ans = ""
for i in range(n):
  ans += str(b[i])+" "
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)//2
else:
  k = n//2
for i in range(n):
  if(i%2==0):
    b[k+i//2]=a[i]
  else:
    b[k-(i+1)//2]=a[i]
print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

a_even = a[0::2]
a_odd  = a[1::2] 
# even
if n % 2 == 0:
    b = a_even.copy()
    b.reverse()
    b = b + a_odd
# odd
else:
    b = a_odd.copy()
    b.reverse()
    b = b + a_even

b = list(map(str, b))
print(' '.join(b))

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
arr = list(map(int, input().split()))

d = deque()
for i, v in enumerate(arr):
    i += 1
    if n % 2:
        if i % 2:
            d.append(v)
        else:
            d.appendleft(v)
    else:
        if i % 2:
            d.append(v)
        else:
            d.appendleft(v)
print(*d)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    anslis = []
    for _ in range(n):
        anslis.append("")

    if n % 2 == 0:
        for i in range(n):
            if i < n // 2:
                a = -2 * i + n 
            else:
                a = (i - n //2) * 2 + 1
            anslis[i] = a
    else:
        for i in range(n):
            if i < n // 2:
                a = -2 * i + n
            elif i == n // 2:
                a = 1
            else:
                a = (i - n//2) * 2
            anslis[i] = a
    print(*anslis)






if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys 

N = int(input())
A = list(map(int, input().split()))


if N == 1:
    print(A[0])
    sys.exit()

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        mae.append(" ")
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        #usiro.insert(0,str(" "))
        Flag = 0

moziretu = (mae + usiro)
#del moziretu[((len(moziretu))//2)]
moziretu = ''.join(moziretu)
print(moziretu)

Submission status: Wrong Answer

Solution code:
import sys 

N = int(input())
A = list(map(int, input().split()))



if N == 1:
    print(A[0])
    sys.exit()

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        mae.append(" ")
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        Flag = 0

moziretu = (mae + usiro)
moziretu = ''.join(moziretu)

print(''.join(moziretu))

Submission status: Wrong Answer

Solution code:
import sys 

N = int(input())
A = list(map(int, input().split()))


if N == 1:
    print(A[0])
    sys.exit()

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        Flag = 0

moziretu = (mae + usiro)
moziretu = ''.join(moziretu)
print(' '.join(moziretu))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(x) for x in input().rstrip().split()]

odd=[]
even=[]
for i in range(n):
  if (i)%2==0:
    even.append(a[i])
  else:
    odd=[a[i]]+odd

print(*(odd+even))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        Flag = 0

moziretu = (mae + usiro)
moziretu = ''.join(moziretu)
print(' '.join(moziretu))

Submission status: Wrong Answer

Solution code:
#https://atcoder.jp/contests/abc066/tasks/arc077_a
N = int(input())
N_List = list(map(str,input().split()))
if N % 2 == 0:
    ans = ''.join(reversed(N_List[1::2])) + ''.join(N_List[::2])
else:
    ans = ''.join(reversed(N_List[::2])) + ''.join(N_List[1::2])

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
    if i%2==1:
        ans.insert(0,a[i])
    else:
        ans.append(a[i])
if n%2==1:
    ans.reverse()
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
if n%2 == 0:
    for i in range(0,(n//2)+2,2):
        b.append(a[i])
        b.insert(0,a[i+1])
else:
    b.append(a[0])
    for h in range(1,(n//2)+1,2):
        b.append(a[h])
        b.insert(0,a[h+1])
print(*b)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))

ans=[]

for i in range(len(a)):
    if i%2==0:
        ans.append(str(a[i]))
    else:
        ans[0:0]=str(a[i])
print(" ".join(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    if n%2 and i==n-1:
        b[i]=a[n//2]
    else:
        if i<n//2:
            b[i]=a[n-i*2-1]
        else:
            b[i]=a[(i-n//2)*2]
print(' '.join(map(str,b)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()

print(' '.join(a[-1:0:-2]+a[::2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

A.reverse()
ans = []

for i in range(0,N,2):
    ans.append(A[i])

A.reverse()

for i in range(0,N,2):
    ans.append(A[i])

[print(i,end=' ') for i in ans]

Submission status: Wrong Answer

Solution code:
n = int(input())
a_lst = input().split()
odd = [a for i, a in enumerate(a_lst) if i % 2 != 0]
even = [a for i, a in enumerate(a_lst) if i % 2 == 0]

if n % 2 == 0:
  b = list(reversed(even)) + odd
else:
  b = list(reversed(odd)) + even
print(' '.join(b))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))

kisu=[]
gusu=[]
for x in range(n):
  if (x+1)%2==1:
    kisu.append(a[x])
  else:
    gusu.append(a[x])
    
gusu.reverse()

ans=gusu+kisu

ans1=[str(f) for f in ans]

ans1=' '.join(ans1)

print(ans1)

Submission status: Wrong Answer

Solution code:
from collections import deque
n=int(input())
a=list(input().split())
b=deque()

for i in range(1,n+1):
  if i%2==1:
    b.append(a[i-1])
  else:
    b.appendleft(a[i-1])
print(" ".join(b))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
head_s = [] 
back_s = []
for h in range(n-1,-1,-2):
	head_s.append(a[h])
for b in range(1,n,2):
	back_s.append(a[b])
print(head_s,back_s)
ans_h = (' '.join(map(str,head_s)))
ans_b = (' '.join(map(str,back_s)))
print(ans_h,ans_b)

'''
123
>>>312
1234
>>>4213
12345
>>>53124
123456
>>>642135

上記の法則より、後ろから偶数個後ろ向きに抽出した数字列が頭
						　前から偶数個抽出した数字列が後ろの数字群

'''

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = []
l = []
for i in range(n):
  if i % 2 == 0:
    r.append(a[i])
  else:
    l.append(a[i])

ans = l[::-1]+r
print(" ".join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
# C - pushpush
n = int(input())
a = list(map(str,input().split()))

b = [""]*n
var = 0

for i in range(n):
    res = a[i]
    var += i*(-1)**i
    ind = n//2 + var
    b[ind] = res

ans = " ".join(b)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]

if n % 2 == 0:
    lis1 = a[::2]
    lis2 = a[::-2]
    ans = lis2 + lis1
else:
    lis1 = a[::-2]
    lis2 = a[1::2]
    ans = lis1 + lis2
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(input().split())
if n > 3:
    ans=''
    ans += ' '.join(a[::-2])
    print(a[::2])
    if n%2==0:
        ans += ' ' + ' '.join(a[0::2])
    else:
        ans += ' ' + ' '.join(a[1::2])
    print(ans)
else:
    ans=[]
    for i in range(n):
        ans.append(a[i])
        ans.reverse()
    print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(input().split())
if n > 3:
    ans=''
    ans += ' '.join(a[::-2])
    ans += ' ' + ' '.join(a[::2])
    print(ans)
else:
    ans=[]
    for i in range(n):
        ans.append(a[i])
        ans.reverse()
    print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
ar = list(reversed(a))
ans = []
if n == 1:
  print(a[0])
else:
  for i in range(0, n, 2):
    ans.append(ar[i])

  for i in range(0, n, 2):
    ans.append(a[i])

  print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

left = []
right = []

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            right.append(a[i])
        else:
            left.append(a[i])
    
    print(left[::-1]+right)
else:
    for i in range(n):
        if i % 2 == 0:
            left.append(a[i])
        else:
            right.append(a[i])
    
    print(left[::-1]+right)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
s=''
for i in range(n):
    if i%2==0:
        s=s+str(a[i])
    else:
        s=str(a[i])+s
if n%2==1:
    s=s[::-1]
print(' '.join(s))

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    deq = collections.deque()
    for i in range(n):
        if i % 2 == 0:
            deq.append(str(a[i]))
        else:
            deq.appendleft(str(a[i]))
    print(" ".join(deq))
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
a = list(map(int, input().split()))

d = deque()
for i, value in enumerate(a, start=1):
    if n % i == 0:
        d.appendleft(value)
    else:
        d.append(value)

for value in d:
    print(f'{value} ', end="")
print()
exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(str,input().split()))
s=''
for i in range(n):
  if i%2==1:
    s=a[i]+s
  else:
    s=s+a[i]
if n%2==0:
  print(*s)
else:
  print(*s[::-1])

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans=''
for i in range(n):
  if i%2==0:
    ans=ans+str(A[i])
  else:
    ans=str(A[i])+ans
if n%2==0:
  print(' '.join(ans))
else:
  print(''.join(ans[::-1]))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()

b = ""

end = 0 if n%2 == 0 else -1
for i in range(n-1, end, -2):
    b += a[i]

start = 0 if n%2 == 0 else 1
for j in range(start, n, 2):
    b += a[j]

print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()

b = ""

end = 0 if n%2 == 0 else -1
for i in range(n-1, end, -2):
    print(i)
    b += a[i]

start = 0 if n%2 == 0 else 1
for j in range(start, n, 2):
    print(j)
    b += a[j]

print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()

b = []

for i in a:
    b.append(i)
    b.reverse()

print("".join(b))

Submission status: Wrong Answer

Solution code:
#ABC066-C
from collections import deque
n = int(input())
a = list(map(int,input().split()))

d = deque()

for i in range(n):
    if i % 2 == 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])

print(*list(d))

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
A = list(map(int,input().split()))
B = deque([])

if n%2 == 0:
    for i in range(n):
        if i%2 == 0:
            B.append(A[i])
        else:
            B.appendleft(A[i])
else:
    for i in range(n//2):
        B.append(A[-(i+1)])
        B.append(A[i])
    B.append(A[n//2])
        
print(*B)

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
A = list(map(int,input().split()))
B = deque([])

for i in range(n):
    if i%2 == 0:
        B.append(A[i])
    else:
        B.appendleft(A[i])
        
print(*B)

Submission status: Wrong Answer

Solution code:
from collections import deque


B = deque()
n = int(input())
A = list(map(int, input().split()))

for i, a in enumerate(A):
    if i % 2 == 0:
        B.append(a)
    else:
        B.appendleft(a)

print(*B)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
odd = []
even = []
ans = []

for i in range(n):
    if i % 2 == 0:
        odd.append(a[i])
    else:
        even.append(a[i])

if n == 1:
    print(a[0])
    exit()
else:
    if n % 2 == 0:
        even.reverse()
        ans = even + odd
    else:
        odd.reverse()
        ans = odd + even

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))

if n == 1:
    print(" ".join(str(l)))
    exit()
2

ans = []

if n%2 == 0:
    tmp = n
    for j in range(n//2-1):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    ans.append(1)
    tmp = 1
    for j in range(n//2-1):
        tmp += 2
        ans.append(tmp)
else:
    tmp = n
    for j in range(n//2):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    tmp = 2
    for j in range(n//2):
        ans.append(tmp)
        tmp += 2

ans2 = [0]*n
cnt = 0
for i in ans:
    ans2[cnt] = str(l[i-1])
    cnt += 1


print(" ".join(ans2))

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))

if n == 1:
    print(" ".join(str(l)))
    exit()
elif n == 2:
    print(2,1)
    exit()

ans = []

if n%2 == 0:
    tmp = n
    for j in range(n//2-1):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    ans.append(1)
    tmp = 1
    for j in range(n//2-1):
        tmp += 2
        ans.append(tmp)
else:
    tmp = n
    for j in range(n//2):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    tmp = 2
    for j in range(n//2):
        ans.append(tmp)
        tmp += 2

ans2 = [0]*n
cnt = 0
for i in ans:
    ans2[cnt] = str(l[i-1])
    cnt += 1


print(" ".join(ans2))

Submission status: Wrong Answer

Solution code:
n  = int(input())
a  = list(map(str, input().split()))

b = []
tmp = []

b_0 = a[::2]
b_1 = a[1::2]


b_1.reverse()


print(" ".join(b_1), end="")
print(" ".join(b_0), end="")

Submission status: Wrong Answer

Solution code:
n = int(input())
L = list(map(int, input().split()))

l = []

if n == 1:
	print(L)
	exit()

if n%2 == 0:
	for i in range (0,n//2):
		l.append(L[n-1-2*i])
	for i in range (0,n//2):
		l.append(L[2*i])
else:
	for i in range (0,n//2+1):
		l.append(L[n-1-2*i])
	for i in range (0,n//2):
		l.append(L[2*i+1])

print(*l)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(input().split())
a1 = ['']*(n//2 + n%2)
a2 = ['']*(n//2)

for i in range(n):
	if i%2 == 0:
		a1[i//2] = a[i]
	else:
		a2[-i//2] = a[i]
ans = ' '.join(a2) + ' ' + ' '.join(a1)
if n%2 != 0 and n != 1:
	print(ans[::-1])
elif n%2 == 0:
	print(ans)
else:
	print(a[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
ogya = []

if n%2==0:
	for i in range (0, n):
		if i%2==0:
			ogya.insert(0, l[i])
		else:
			ogya.append(l[i])
else:
	for i in range (0, n):
		if i%2==0:
			ogya.append(l[i])
		else:
			ogya.insert(0, l[i])

print(*ogya)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    for i in range(n-1,0,-2):
        print(a[i],end="")
    for i in range(0,n,2):
        print(a[i],end="")
else:
    for i in range(n-1,-1,-2):
        print(a[i],end="")
    for i in range(1,n,2):
        print(a[i],end="")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
c = []
for i in a[::-1]:
    if i % 2 == 0:
        b.append(i)
    else:
        c.append(i)
if n % 2 == 0:
    c.reverse()
else:
    c, b = b, c

print(*b+c)

Submission status: Wrong Answer

Solution code:
n = int(input())
*a, = map(int, input().split())
ans = a[2::2] + [a[0]] + a[1::2]
if n%2==0:
    ans = ans[::-1]
print(*ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
print(*b)

Submission status: Wrong Answer

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n=l()[0]
A=l()
ans=[]
for i in range(n):
    if(i%2==0):
        ans+=[A[i]]
    else:
        ans=[A[i]]+ans
print(*ans)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
A = list(map(int, input().split()))
ans = collections.deque()
for i in range(N):
    if i % 2 == 0:
        ans.append(A[i])
    else:
        ans.appendleft(A[i])
print(*ans)

Submission status: Wrong Answer

Solution code:
# dequeでいくわ
from collections import deque
n = int(input())
a = list(input().split())
ans = deque()
for i in range(n):
    if i % 2 == 0:
        ans.append(a[i])
    else:
        ans.appendleft(a[i])
print(" ".join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

a_even = list(filter(lambda x: x % 2 == 0, a))
a_odd = list(filter(lambda x: x % 2 != 0, a))

ans = a_even[::-1] + a_odd
if n % 2 != 0:
  ans = ans[::-1]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

a_even = list(filter(lambda x: x % 2 == 0, a))
a_odd = list(filter(lambda x: x % 2 != 0, a))

ans = a_odd[::-1] + a_even
if n % 2 == 0:
  ans = ans[::-1]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

a_even = list(filter(lambda x: x % 2 == 0, a))
a_odd = list(filter(lambda x: x % 2 != 0, a))

ans = a_even[::-1] + a_odd
if n % 2 == 0:
  ans = ans[::-1]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
al = list(map(int,input().split()))

b = deque()

for i in range(n):
    if i % 2 != 0:
        b.appendleft(str(al[i]))
    else:
        b.append(str(al[i]))
print(' '.join(b))

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
a = list(map(str,input().split()))
b = deque()

for i in range(n):
  if i%2== 0:
    b.append(a[i])
  else:
    b.appendleft(a[i])
  
B = ' '.join(b)
print(B)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(str,input().split()))
b = []

for i in range(n):
  if i%2== 0:
    b.append(a[i])
  else:
    b.insert(0,a[i])
  
B = ' '.join(b)
print(B)

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
a = list(map(int,input().split()))

d = deque()

for i in range(n):
    if i%2 == 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])
print(' '.join(map(str,list(d))))

Submission status: Wrong Answer

Solution code:
import collections
def solve():
  n = int(input())
  a = list(map(int, input().split()))
  b = collections.deque()
  for i in range(n):
    if i % 2 == n % 2:
      b.append(a[i])
    else:
      b.appendleft(a[i])
  if n % 2 == 0:
    b.reverse()
  b = map(str, b)
  print(" ".join(b))
  return 0
 
if __name__ == "__main__":
  solve()

Submission status: Wrong Answer

Solution code:
import collections
def solve():
  n = int(input())
  a = list(map(int, input().split()))
  b = collections.deque()
  for i in range(n):
    if i % 2 == n % 2:
      b.append(a[i])
    else:
      b.appendleft(a[i])
  if n % 2 == 1:
    b.reverse()
  b = map(str, b)
  print(" ".join(b))
  return 0
 
if __name__ == "__main__":
  solve()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[]
r=[]
for i in range(len(a)):
  if i%2==0:
    r.append(a[i])
  else:
    l.append(a[i])
t=l[::-1]+r
print(*t)

Submission status: Wrong Answer

Solution code:
n = int(input())
As = list(map(str, input().split()))

from collections import deque
b = []
b = deque(b)

for i, a in enumerate(As):
    if i%2==0:
        b.append(a)
    else:
        b.appendleft(a)

if n%2==0:
    print(''.join(b))
else:
    print(''.join(reversed(b)))

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))


res = [0]*n
m = n //2

if n % 2 ==0:
    for i in range(m):
        res[i] = al[-1-i*2]    
    for j in range(m):
        res[m+j]= al[j*2]
        
    print(res)
    
else:
    for i in range(m+1):
        res[i] = al[-1-i*2]
    for j in range(m):
        res[m+1+j] = al[1+j*2]
    print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

B = A[::2][::-1] + A[1::2]
if N % 2 == 0:
    B = B[::-1]
print(B)

Submission status: Wrong Answer

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    b.append(seq[n-1])
    for j in range(0, n-1, 2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))

Submission status: Wrong Answer

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = [seq[n-1]]

if n % 2 == 0:
    for j in range(1, n, 2):
        if j != n-1:
            b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    for j in range(0, n, 2):
        if j != n-1:
            b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))