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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n = n//a
    count += 1
  if a**count == n:
    return count
  else:
    return count+1

#############
# Main Code #
#############

N = I()
A = IL()

iti = A[::2]
ni = A[1::2]

print(*(ni[::-1]+iti),sep=" ")

Submission status: Wrong Answer

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

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

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

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.append(a[i])
  else:
    ans.insert(0,a[i])
if n%2 == 0:
  pass
else:
  ans[::-1]
for an in ans:
  print(an,end=' ')

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.append(a[i])
  else:
    ans.insert(0,a[i])
for an in ans:
  print(an,end=' ')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import os

def file_input():
    f = open('ABC066/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    n=int(input())
    a=list(map(int, input().split()))

    out=[""]*n

    for i in range(n):
        if i%2==0:
            out[n//2+i//2]=str(a[i])
        else:
            out[n//2-(-(-i//2))]=str(a[i])
    if n%2!=0:
        out.reverse()

    print("".join(out))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os

def file_input():
    f = open('ABC066/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    n=int(input())
    a=list(map(int, input().split()))

    out=[]

    for i in range(n):
        if i%2==0:
            out.append(str(a[i]))
        else:
            out.insert(0,str(a[i]))
    if n%2!=0:
        out.reverse()

    print("".join(out))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import deque
def main():
    n = int(input())
    a = list(map(str, 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])
    if n%2 == 1:
        print(" ".join(sorted(b, reverse = True)))
    else:
        print(" ".join(b))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[i for i in 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])
else:
    for i in range(n):
        if i%2==0:
            c.append(a[i])
        else:
            b.append(a[i])
print(b,c)
c=c[::-1]
print(" ".join(c)+" "+" ".join(b))

Submission status: Wrong Answer

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

before_turn = []
for i in reversed(A[1::2]):
    before_turn.append(i)

for i in A[::2]:
    before_turn.append(i)

if N == 3:
    turn = before_turn[::-1]
    print(" ".join(map(str, turn)))
else:
    print(" ".join(map(str, before_turn)))

Submission status: Wrong Answer

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

before_turn = []
for i in reversed(A[1::2]):
    before_turn.append(i)

for i in A[::2]:
    before_turn.append(i)

ans = " ".join(map(str, before_turn))

if N % 2 == 0 or N == 1:
    print(" ".join(map(str, before_turn)))
else:
    print(" ".join(map(str, before_turn))[::-1])

Submission status: Wrong Answer

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

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

for i in range(len(d)):
    print(d[i]+" ",end="")

Submission status: Wrong Answer

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

for i in range(len(a)):
    if i%2 == 0:
        b.append(a[i])
    else:
        b.insert(0,a[i])
print(' '.join(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(1,n+1):
  if i%2 != 0:
    b.append(a[i-1])
  else:
    b.appendleft(a[i-1])
    
    
b = list(map(str,b))
B = " ".join(b)

if n%2 != 0:
  print(B[::-1])
else:
  print(B)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
if n%2:
    print(" ".join(map(str, a[::2] + a[::-1][1::2])))
else:
    print(" ".join(map(str, a[::-1][::2] + a[::2])))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
a_odd = a[1::2]
a_even = a[0::2]

if n % 2 == 0:
    a_odd.reverse()
    ans = a_even + a_odd
else:
    a_even.reverse()
    ans = a_odd + a_even
print(' '.join(ans))

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 x in range(n):
    if x%2==0:
      b.append(a[x])
    else:
      b.appendleft(a[x])
if n%2==1:
  for y in range(n):
    if y%2==0:
      b.appendleft(a[y])
    else:
      b.append(a[y])
print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
b = ""
inv = 1
for i in range(n):
    a = str(A[i])
    if inv ==1:
        b = b+a
    else:
        b = a+b
    inv *=-1
if inv ==1:
    print(*list(b))
else:
    print(*list(b[::-1]))

Submission status: Wrong Answer

Solution code:
def main2():
    N = int(input().strip())
    init_array=[]
    stack=[]
    r_stack=[]
    [init_array.append(int(i)) for i in (input().split())]
    for i,n in enumerate(init_array):
        if i==0:
            stack.append(n)
            r_stack.append(n)
        elif i%2!=0:
            stack.append(n)
            r_stack.insert(0,n)
        else:
            stack.insert(0,n)
            r_stack.append(n)
    ans_list=[str(num) for num in r_stack]
    ans=' '.join(ans_list)
    print(ans)

if __name__ == "__main__":
    main2()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
b = [-1] *N

for i in range((N+1)//2):
  b[i] = str(a[N-1-i*2])
for i in range(N //2):
  b[i+((N+1)//2)] = str(a[(2*i + ((N+1) % 2))-1])
print(" ".join(b))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
from collections import deque
ans = deque([a[0]])
odd = True
for i in range(1,n):
    if odd:
        ans.appendleft(a[i])
        odd = False
    else:
        ans.append(a[i])
        odd = True
ans = list(ans)
for i in range(n):
    print(ans[i],end = ' ')

Submission status: Wrong Answer

Solution code:
from collections import deque
n=int(input())
a=input().split()
s=deque([])
for i in range(n):
    if i%2:
        s.appendleft(a[i])
    else:
        s.append(a[i])
print(str(s).replace(' ','').replace(',',' ').replace('deque([','').replace('])','\n').replace("'",''))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
flag = True
for i in range(n):
    if flag:
        b.append(a[i])
        flag = False
    else:
        b.insert(0, a[i])
        flag = True
for i in range(n):
    print(b[i], end=" ")
print()

Submission status: Wrong Answer

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

if len(li)%2 == 0:
    ans = sorted(li[1::2], reverse=True) + li[::2]
else:
    ans = sorted(li[::2], reverse=True) + li[1::2]

print(*ans)

Submission status: Wrong Answer

Solution code:
S = input()
flag = False
count = 0
for i in range(len(S)): #後ろから文字を消す
    S = S[0:len(S)-1]
    if len(S)%2==0: #Sが偶数文字数
        hl = int(len(S)/2)
        for k in range(hl): #Sの最初からと半分からが同じか判定
            if S[k]!=S[k+hl]:
                break
            else:
                count += 1
                
            if count == hl:
                print(hl*2)
                flag = True
                break

    if flag:
        break

Submission status: Wrong Answer

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

for i in range(n):
    if i%2==1:
        s.insert(0,' ')
        s.insert(0, a[i])
    else:
        s.append(a[i])
        s.append(' ')

s.pop(-1)
print(s)
s = ''.join(map(str,s))
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = []
for i in a:
    s.append(i)
    s.reverse()
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input().split())
res = ""
for i in range(n):
    if i%2 == 0:
        res+=str(i)
    else:
        res = str(i)+res
ans = ""
if n%2:
    res =res[::-1]
for x in res:
    ans += s[int(x)]
    
    
p = list(ans)
print(*p)

Submission status: Wrong Answer

Solution code:
from collections import deque
N=int(input())
A=list(map(int,input().split()))
l=[]
r=[]
for i in range(N):
  if i%2==0:
    r.append(A[i])
  else:
    l.append(A[i])
l=list(reversed(l))
r=list(r)
print(*l,end=" ")
print(*r)

Submission status: Wrong Answer

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

begin = a[0::2]
end = a[1::2]

if n%2 == 0:
    end = end[:-1]
    ans = end+begin
else:
    begin = begin[::-1]
    ans = begin+end
    
Ans = ''
for i in range(len(ans)):

    if i == len(ans)-1:
        Ans = Ans + str(ans[i])
    else:
        Ans = Ans + str(ans[i]) +' '

print(Ans)

Submission status: Wrong Answer

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

for i,x in enumerate(a):
    if i%2==1:
        b.appendleft(x)
    else:
        b.append(x)
for i in b:
    print(i)

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:
n = int(input())
a = list(map(int,input().split()))

for i in reversed(range(n)):
    if i % 2 == 1:
        print(a[i], end=" ")
for i in range(n):
    if i % 2 == 0:
        print(a[i],end = " ")

Submission status: Wrong Answer

Solution code:
from collections import deque

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

for i in range(n):
    b.append(a.popleft())
    b.reverse()

    print(*b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(str,input().split()))
b = a[::-1]
b = b[::2]
c = a[::2]
d = b+c
if n >= 2:
  print(' '.join(d))
else:
  print(a[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a:
  b.append(i)
  b = b[::-1]
print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = input().split()
ans = ''
cnt = 1
for a in A:
    if n%2==0:
        a = a + ' '
        if cnt%2==1: ans += a
        else: ans = a + ans
    else:
        if cnt%2==1: ans = a+ans
        else: ans+=a
    cnt += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if n%2==0:
	print(ogya, sep=" ")
else:
	ogya.reverse()
	print(ogya, sep=" ")

Submission status: Wrong Answer

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

b = collections.deque()

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

print(" ".join(b))

Submission status: Wrong Answer

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

from collections import deque
b = deque([])
for i in range(1, N + 1):
    if i % 2 == 0:
        b.appendleft(a[i - 1])
    else:
        b.append(a[i - 1])

print(' '.join([str(i) for i in b]))

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
l = map(int, input().split())
d = deque()
for i in l:
    if i % 2 == 1:
        d.appendleft(i)
    else:
        d.append(i)
if n % 2 == 0:
    d.reverse()
print(' '.join(map(str, d)))

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
l = input().split()
d = deque()
for i in l:
    if int(i) % 2 == 1:
        d.appendleft(i)
    else:
        d.append(i)
if n % 2 == 0:
    d.reverse()
print(' '.join(d))

Submission status: Wrong Answer

Solution code:
N = int(input())
Ai = input().split()
b = ""

for n, A in enumerate(Ai):
  if n%2 == 0:
    b = A + b 
  else:
    b = b + A
if N%2 == 0: b = b[::-1]
print(*[bb for bb in b], sep=" ")

Submission status: Wrong Answer

Solution code:
input();l=list(input().split());print(*l[-1::-2]+l[::2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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(a[i],b)
  
print(b)

Submission status: Wrong Answer

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

odd, even = [], []

odd = [i for i in l if i % 2 == 1]
even = [j for j in l if j % 2 == 0]

even.reverse()
e_o = even + odd

if n%2 == 1:
    e_o.reverse()
    print(*e_o)
else:
    print(*e_o)

Submission status: Wrong Answer

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

if len(a)%2 == 0:
    for i in range(len(a)//2):
        b.append(ar[i*2])
        c.append(a[i*2])
else:
    for i in range(-(-(len(a))//2)):
        print (i)
        if i == len(a)//2:
            b.append(ar[(i*2)])
        else:
            b.append(ar[i*2])
            c.append(a[(i*2)+1])

print(' '.join(map(str, b+c)))

Submission status: Wrong Answer

Solution code:
from collections import deque

n = int(input())
aa = list(map(int, input().split()))
bb = deque()
left = True
for a in aa:
    if left:
        bb.append(a)
    else:
        bb.appendleft(a)
    left = not left

if left:
    print(list(bb))
else:
    print(list(bb).reverse())

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=deque(limii())
b=deque([])
for i in range(n):
    if i%2==1:
        x=arr.popleft()
        b.appendleft(str(x))

    else:
        x=arr.popleft()
        b.append(str(x))
print(" ".join(list(b)))

Submission status: Wrong Answer

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

if cnt%2==0:
    print(" ".join(list(ans)))
else:
    print(" ".join(reversed(list(ans))))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
res1 = []
res2 = []
if n % 2 == 1:
  res1.append(a.pop(-1))
  n = n -1
for i in range(n//2):
  res1.append(a[n-1-2*i])
  res2.append(a[i*2])
res1.extend(res2)
print(*res1)

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.appendleft(a[i])
        else:
            b.append(a[i])
else:
    for j in range(n):
        if j % 2 == 0:  # 偶数なら後ろ
            b.appendleft(a[j])
        else:
            b.append(a[j])

Submission status: Wrong Answer

Solution code:
def main():
  n = int(input())
  a = list(input_list_str())
  index = n - 1
  ans = [a[index]]
  
  is_add = False
  for i in range(n-1):
    if is_add:
      index += 2
    else:
      index -= 2
    ans.append(a[index])
    
    if index == 0:
      index = -1
      is_add = True
    elif index < 0:
      index = 0
      is_add = True
      
  print(' '.join(ans))


def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

import math
import fractions
from functools import reduce
main()

Submission status: Wrong Answer

Solution code:
from collections import deque

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

ans = deque()

for i in range(0,n):
    if i %2 != 0:
        ans.appendleft(a_L[i])
    else:
        ans.append(a_L[i])

print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(_) for _ in input().split()]
left = [0] * (n//2)
right = [0] * (n//2)
if n % 2 == 0:
    left = a[n:0:-2]
    right = a[0:n:2]
    ans = left + right
else:
    left  = a[n:1:-2]
    right = a[1:n:2]
    ans = left + [a[0]] + right
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
ans=[]
for i in range((n+1)//2):
  print(l[n-2*i-1],end=' ')
for i in range(n//2):
  print(l[2*i],end=' ')

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(*d)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
b=[]
for i in range(n):
  b.append(l[i])
  b.reverse()
print(b)

Submission status: Wrong Answer

Solution code:
# ABC066c
from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


n = int(input())
a = list(map(int, input().split()))
b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
        continue
    b.appendleft(a[i])
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])
        
for i in b:
    print(i, end=' ')

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
A=input().split()

if len(A)==1:
    print(A[0])
    exit()
    
B1=A[::2]
B2=A[1::2]

print(B1,B2)
if N%2==0:
    B2.reverse()
    B2.extend(B1)
    print(' '.join(B2))
else:
    B1.reverse()
    B1.extend(B2)
    print(' '.join(B1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
odd = a[::2]
even = a[1::2]
even.reverse()
ans = even + odd
print(" ".join(list(map(str, ans))))

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ans = []
for i in l:
  ans.append(i)
  ans = ans[::-1]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

def pushpush(n , a):

    ans = [a[i] for i in range(0 , n , 2)]
    ansb = [a[i] for i in range(1 , n , 2)]

    if n % 2 == 0:
        return ansb[::-1] + ans
    else:
        return ans[::-1] + ansb[::-1]

def main():
    n = int(input())
    a = list(map(int , input().split()))
    print(*pushpush(n , a))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def pushpush(n , a):

    ans = []

    for i in range(n):
        if i % 2 == 0:
            ans = ans + [a[i]]
        else:
            #ans.insert(0 , int(a[i]))
            ans = [a[i]] + ans

    return ans

def main():
    n = int(input())
    a = list(map(int , input().split()))
    print(*pushpush(n , a))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def pushpush(n , a):

    ans = []

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

    return ans

def main():
    n = int(input())
    a = list(map(int , input().split()))
    print(*pushpush(n , a))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input().split()
a = []
for i in range(n):
    a += s[i]
    a = a[::-1]
print(" ".join(a))

Submission status: Wrong Answer

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

b = [-1] * (n + 2)

mid = n // 2
left = mid - 1
right = mid + 1

b[mid] = a[0]

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

for i in b:
  if i < 0:
    continue
  print(i)

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.reverse()

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(n - 1, 0, -2):
        print(i)
        b.append(a[i])
    for i in range(0, n, 2):
        print(i)
        b.append(a[i])
else:
    for i in range(n - 1, -1, -2):
        print(i)
        b.append(a[i])
    for i in range(1, n, 2):
        print(i)
        b.append(a[i])

for i in range(len(b)):
    print(b[i], end=" ")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
b=[]
k=1
for i in range(n):

    b.append("{}".format(A[-k]))
    if k==n or k==(n-1):
        k=0
    k+=2

print(" ".join(b))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
b=[]
k=1
for i in range(n):

    b.append("{}".format(A[-k]))
    if k==n or k==(n-1):
        k=0
    k+=2

if n%2==0:
    b.reverse()
    print(" ".join(b))
else:
    print(" ".join(b))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = ""
for i in range(N):
    if i % 2 == 0:
        ans += str(A[i])
    else:
        ans = str(A[i]) + ans
if N % 2 != 0:
    print(*list(ans)[::-1])
else:
    print(*list(ans))

Submission status: Wrong Answer

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

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

if n%2 == 1:
    b.reverse()

print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ki=a[0::2]
ki2=[]
for i in ki[::-1]:
    ki2.append(i)
guu=a[1::2]
guu2=[]
for i in guu[::-1]:
    guu2.append(i)

if n%2==0:
    kotae=guu2+ki
else:
    kotae=ki2+guu

print(kotae)