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: Accepted

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

B0=[A[i] for i in range(0,n,2)]
B1=[A[i] for i in range(1,n,2)]

if n%2==0:
    C=B1[::-1]+B0

else:
    C=B0[::-1]+B1

for j in C:
    print(j,end=" ")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
if n%2==0: print(" ".join(a[::-2]+a[::2]))
else: print(" ".join(a[::-2]+a[1::2]))

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

    que = deque()
    for i in range(N):
        if i % 2 == 0:
            que.append(A[i])
        else:
            que.appendleft(A[i])

    if N % 2 == 1:
        que.reverse()
    print(*que, sep=" ")

    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
l, r = [], []
for i, ai in enumerate(a):
    if i % 2 == 0:
        r.append(ai)
    else:
        l.append(ai)
if n % 2 == 0:
    print(" ".join(l[::-1]) + " " + " ".join(r))
else:
    print(" ".join(r[::-1]) + " " + " ".join(l))

Submission status: Accepted

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

ans = []
for a in A[::2]:
    ans.append(a)
ans = ans[::-1]
for a in A[1::2]:
    ans.append(a)
print(*(ans if len(ans) & 1 else ans[::-1]))

Submission status: Accepted

Solution code:
n = int(input())
A = [x for x in input().split()]
A_ = A[0::2][::-1] + A[1::2]
if n % 2 == 0:
  A_ = A_[::-1]
print(' '.join(A_))

Submission status: Accepted

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

b_list_even = []
b_list_odd = []
for i, a in enumerate(a_list , start=1):
    if i % 2 == 0:
        b_list_even.append(a)
    else:
        b_list_odd.append(a)


if n % 2 != 0:
    b_list_odd.reverse()
    b_list = b_list_odd + b_list_even
else:
    b_list_even.reverse()
    b_list = b_list_even + b_list_odd

print(" ".join(map(str, b_list)))

Submission status: Accepted

Solution code:
#ABC066C
n=int(input())
a=list(map(int, input().split()))
flg=n%2
half=n//2
front=[0]*(half+flg)
back=[0]*(half)
for i in range(half):
    front[half+flg-1-i]=a[2*i-flg+1]
    back[i]=a[2*i+flg]
if flg==1:
    front[0]=a[n-1]
print(' '.join(map(str, front+back)))

Submission status: Accepted

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

if n % 2 == 0:
    back = [A[2 * i] for i in range(n // 2)]
    front = [A[2 * i + 1] for i in range(n // 2)][::-1]
    ans = front + back

else:
    back = [A[2 * i + 1] for i in range(n // 2)]
    center = [A[0]]
    front = [A[2 * i + 2] for i in range(n // 2)][::-1]
    ans = front + center + back

ans = [str(i) for i in ans]
print(" ".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

ans = []
if N % 2 == 0:
  ans = A[N-1:0:-2] + A[0:N:2]
else:
  ans = A[N:0:-2] + A[0:1] + A[1:N-1:2]

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

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(str,input().split()))
li = lis[::2]
l = lis[1::2]

if n % 2 == 0:
  l = l[::-1]
  ans = l+li
  print(" ".join(ans))
else:
  li = li[::-1]
  ans = li+l
  print(" ".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
b = input().split()
if len(b) % 2 ==0:
    print(" ".join(b[::-2] + b[::2]))
else:
    print(" ".join(b[::-2] + b[1::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = li_input()

    B = [-1] * N

    l = 0
    r = N - 1
    i = N - 1

    while l < r:
        B[l] = A[i]
        B[r] = A[i - 1]
        l += 1
        r -= 1
        i -= 2

    if l == r:
        B[l] = A[0]

    print(" ".join(list(map(str, B))))


main()

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
A = list( map( int, input().split()))
B = deque()
reverse = 0
for i in range(n):
    if reverse == 0:
        B.append(A[i])
        reverse = 1
    else:
        B.appendleft(A[i])
        reverse = 0
B = list(B)
if reverse == 1:
    B = B[::-1]
print( ' '.join( list( map(str, B))))

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
A = list( map( int, input().split()))
B = deque()
reverse = 0
for i in range(n):
    if reverse == 0:
        B.append(A[i])
        reverse = 1
    else:
        B.appendleft(A[i])
        reverse = 0
B = list(B)
if reverse == 1:
    B = B[::-1]
for i in range(n-1):
    print(B[i], end = ' ')
print(B[n-1])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
O = []
E = []
def inv(X):
    X_new = []
    for i in range(len(X)):
        X_new.append(X[len(X)-i-1])
    return X_new
for i in range(N):
    if i % 2 == 0:
        O.append(A[i])
    else:
        E.append(A[i])
if N % 2 == 0:
    print(' '.join(map(str, inv(E)+O)))
else:
    print(' '.join(map(str, inv(O)+E)))

Submission status: Accepted

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

ans = [0]*n
for i in range(n):
    if i%2 == 0:
        ans[i//2] = str(a[-i-1])
    else:
        ans[n-1-i//2] = str(a[-i-1])
print(' '.join(ans))

Submission status: Accepted

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

if n%2==1:
    res = a[::-2] + a[1::2]
else:
    res = a[::-2] + a[::2]

print(str(res).replace(',','')[1:-1])

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
a = [int(v) for v in input().split()]

b = deque()

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

if n % 2 == 0:
    b = reversed(b)

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

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
b = []
for i in range(n - 1, -1, -2):
  b.extend([a[i]])
for j in range(n % 2, n, 2):
  b.extend([a[j]])
print(" ".join(b))

Submission status: Accepted

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

if n % 2 == 0:
    ind_1 = [2*i for i in range(1, n//2+1)][::-1]
    b_front = [str(a[i-1]) for i in ind_1]
    ind_2 = [2*i-1 for i in range(1, n//2+1)]
    b_back = [str(a[i-1]) for i in ind_2]
    b = b_front + b_back
    print(' '.join(b))
else:
    ind_1 = [2*i-1 for i in range(1, n//2+2)][::-1]
    b_front = [str(a[i-1]) for i in ind_1]
    ind_2 = [2*i for i in range(1, n//2+1)]
    b_back = [str(a[i-1]) for i in ind_2]
    b = b_front + b_back
    print(' '.join(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    p = [a_list[i] for i in range(0, n, 2)]
    q = [a_list[i] for i in range(1, n, 2)]

    if n % 2 == 0:
        print(' '.join(map(str, q[::-1] + p)))
    else:
        print(' '.join(map(str, p[::-1] + q)))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
p = [a[i] for i in range(0, n, 2)]
q = [a[i] for i in range(1, n, 2)]

if n % 2 == 0:
    print(" ".join(map(str, q[::-1] + p)))
else:
    print(" ".join(map(str, p[::-1] + q)))

Submission status: Accepted

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

print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
m=[]
for i in range(n-1,-1,-2):
  m.extend([str(l[i])])
for i in range(n%2,n,2):
  m.extend([str(l[i])])
print(" ".join(m))

Submission status: Accepted

Solution code:

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, input().split()))

n = int(input())
aa = inpl_int()

b = []

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

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

Submission status: Accepted

Solution code:
def inpl(): return input().split()

n = int(input())
a = inpl()
l = sorted(range(n), reverse=True)[::2]
r = list(range(n % 2, n))[::2]
ret = list(a[i] for i in (l + r))
print(' '.join(ret))

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
odd, even = [], []
for i, elem in enumerate(a):
    if i % 2 == 0:
        odd.append(elem)
    else:
        even.append(elem)
if n % 2 == 0:
    print(" ".join(map(str, even[::-1])), end=" ")
    print(" ".join(map(str, odd)))
else:
    print(" ".join(map(str, odd[::-1])), end=" ")
    print(" ".join(map(str, even)))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = a[::2]
c = a[1::2]
br = a[-2::-2]
cr = a[::-2]

if n%2==0:
    print(' '.join(map(str, cr+b)))
else:
    print(' '.join(map(str, cr + c)))

Submission status: Accepted

Solution code:
import collections
n = int(input())

arr = map(int,raw_input().split())

deque = collections.deque()

for i in range(n):
	if i % 2 == 0:
		deque.appendleft(arr[i])

	else :
		deque.append(arr[i])

for i in range(n) :
	arr[i] = str(deque.pop())

if i % 2 == 1:
	print ' '.join(arr)

else :
	print ' '.join(reversed(arr))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b_1 = []
b_2 = []
b = []
for i in reversed(range(len(a))):
	if i % 2 != 0:
		b_1.append(a[i])
	else:
		b_2.append(a[i])
if len(a) % 2 == 0:
	b_2.reverse()
	b.extend(b_1)
	b.extend(b_2)
else:
	b_1.reverse()
	b.extend(b_2)
	b.extend(b_1)
for b_num in b:
	print(b_num, end = ' ')

Submission status: Accepted

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

Submission status: Accepted

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


if N % 2 == 1:
    b = [a[i] for i in range(len(a)) if i % 2 == 0][::-1]
    c = [a[i] for i in range(len(a)) if i % 2 == 1]
    ans = list(map(str, b + c))
    print(" ".join(ans))
else:
    b = [a[i] for i in range(len(a)) if i % 2 == 1][::-1]
    c = [a[i] for i in range(len(a)) if i % 2 == 0]
    ans = list(map(str, b + c))
    print(" ".join(ans))

Submission status: Accepted

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

new_a = [0 for x in range(N)]

sw = False 
cnt = 0

for i in range(N) :
    new_a[cnt] = a[N - i - 1]
    if sw == False :
        cnt = N - cnt - 1
        sw = True
    else :
        cnt = -(cnt - N + 1) + 1
        sw = False
    
print(" ".join(map(str,new_a)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 普通のリストじゃなくてこれ使えば、左への挿入も速いとのこと
from collections import deque

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

bN = deque()
if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0:
            bN.append(str(aN[i]))
        else:
            bN.appendleft(str(aN[i]))
else:
    for i in range(N):
        if i % 2 == 1:
            bN.append(str(aN[i]))
        else:
            bN.appendleft(str(aN[i]))

print(" ".join(bN))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

bN = [0] * N
if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0:
            bN[(N//2) + i//2] = str(aN[i])
        else:
            bN[(N//2) - (i+1)//2] = str(aN[i])
else:
    for i in range(N):
        if i % 2 == 0:
            bN[(N//2) - i//2] = str(aN[i])
        else:
            bN[(N//2) + (i+1)//2] = str(aN[i])

print(" ".join(bN))

Submission status: Accepted

Solution code:

N=int(input())

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

ans = []


for i in range(N-2,N%2-1,-2):
    ans.append(str(a[i]))
    
for i in range((N-1)%2,N,2):
    ans.append(str(a[i]))

ans.reverse()

print(' '.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
a = list(map(int,input().split()))
appLeft = n%2!=0
i = 0
ans = deque()
while i < n:
    if appLeft:
        ans.appendleft(a[i])
    else:
        ans.append(a[i])
    appLeft = not appLeft
    i+=1
print(" ".join(list(map(str,list(ans)))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

if n % 2 == 0:
    left = sorted([i*2+1 for i in range(n//2)], reverse=True)
    for i in range(len(left)):
        left[i] = A[left[i]]
    print(' '.join(list(map(str, left)) + [str(A[j*2]) for j in range(n//2)]))
else:
    left = sorted([i*2+2 for i in range(n//2)], reverse=True)
    for i in range(len(left)):
        left[i] = A[left[i]]
    print(' '.join(list(map(str, left)) + [str(A[0])] + [str(A[j*2+1]) for j in range(n//2)]))

Submission status: Accepted

Solution code:
n=int(input())
#n,k=map(int,input().split())
l=[int(i) for i in input().split()]
res=[]
for i in range(-1,-n-1,-2):
    res.append(l[i])
for i in range(0+n%2,n,2):
    res.append(l[i])

print(*res)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
i = n-1
while i >=1:
  b.append(a[i])
  i = i-2
b.append(a[0])
if n%2==0:
  j=2
else:
  j =1
while j <= n-2:
  b.append(a[j])
  j = j+2
for nums in b:
  print(nums, end = ' ')

Submission status: Accepted

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

for i in range(n - 1, (n + 1) % 2 - 1, -2):
    print(A[i], end = " ")
for j in range(n % 2, n - 1, 2):
    print(A[j], end = " ")

Submission status: Accepted

Solution code:
# input
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 j in range(0, n - 1, 2):
        print(A[j], end = " ")
else:
    for i in range(n - 1, -1, -2):
        print(A[i], end = " ")
    for j in range(1, n - 1, 2):
        print(A[j], end = " ")

Submission status: Accepted

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

r = [0] * N
x = 0
for i in range(N):
    r[x] = A[-i-1]
    x = N - 1 - x
    if x * 2 < N:
        x += 1

print(*r)

Submission status: Accepted

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

b = []
count = 0
for i in range(n):
    count += 1 
    gyaku = (n-1) - i
    if count%2 == 1:
        b.append(a[gyaku])

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

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

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())

result = deque()
index = 0

def front_enque(i):
    global result, index
    result.appendleft(i)
    index += 1

def enque(i):
    global result, index
    result.append(i)
    index += 1

if n % 2 == 0:
    for i in input().split():
        if index % 2 == 1:
            front_enque(i)
        else:
            enque(i)
else:
    for i in input().split():
        if index % 2 == 1:
            enque(i)
        else:
            front_enque(i)

print(" ".join(result))

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())

result = deque()
index = 0

if n % 2 == 0:
    for i in input().split():
        if index % 2 == 1:
            result.appendleft(i)
            index += 1
        else:
            result.append(i)
            index += 1
else:
    for i in input().split():
        if index % 2 == 1:
            result.append(i)
            index += 1
        else:
            result.appendleft(i)
            index += 1

print(" ".join(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
src = list(map(int,input().split()))
ans =  list(reversed(src[(N+1)%2::2])) + src[N%2::2]
print(*ans)

Submission status: Accepted

Solution code:
def getinputdata():

    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
arr = arr_data[1]

arr1=[]
for i in range(n-1,-1,-2):
    arr1.append(arr[i])
    
sposi=0 if n % 2==0 else 1

for j in range(sposi,n,2):
    arr1.append(arr[j])

print(" ".join(arr1))

Submission status: Accepted

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

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

    to_str = map(str, ans)
    return " ".join(to_str)

print(main())

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(str, input().split()))
b = a[::-2] + a[len(a)%2::2]
print(' '.join(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
if N%2==0:
    B = A[1::2][::-1]+A[0::2]
else:
    B = A[0::2][::-1]+A[1::2]
print(" ".join(map(str,B)))

Submission status: Accepted

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

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

if n%2 == 0:
    even, odd = odd, even
even.reverse()
print(" ".join(even) + " " + " ".join(odd))

Submission status: Accepted

Solution code:
n=int(input())
a=input().split()
print(" ".join(a[-1::-2]+a[(n % 2)::2]))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
a = input().split()
b = deque([])
for i, num in enumerate(a):
  if n%2 == i%2:
    b.append(num)
  else:
    b.appendleft(num)
    

print(" ".join(b))

Submission status: Accepted

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

if n % 2 == 0:
  ans = b[::-1] + a
  print(' '.join(map(str, ans)))
else:
  ans = a[::-1] + b
  print(' '.join(map(str, ans)))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]

b[n//2] = a[0]
idx = n - 1
for i in range(0, n//2):
    b[i] = a[idx]
    idx -= 2

idx = 1 + (n+1) % 2
for i in range(n//2+1, n):
    b[i] = a[idx]
    idx += 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = []
C = []
for k in range(N):
    if k%2 == 0:
        B.append(A[k])
    else:
        C.append(A[k])

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

Submission status: Accepted

Solution code:
n = int(input())
ll = list(map(int,input().split()))
mm = []
pp = n
i = 0
for i in range(n):
    try:
        mm.append(str(ll[-1-2*i]))
        ll[-1-2*i] = '-1'
    except:
        pass

    
for i in range(len(ll)):
    if ll[i] != '-1':
        mm.append(str(ll[i]))
    else:
        None
        
sss = ''
for i in mm:
    print(i, end= ' ')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

n=int(input())

a=[int(i) for i in input().split()]

b=deque()

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

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

n_int = map(str, b)
answer = " ".join(n_int)
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
src = list(map(int,input().split()))
ans = list(reversed(src[(N+1)%2::2])) + src[N%2::2]
print(*ans)

Submission status: Accepted

Solution code:
N=int(input())
s=list(input().split())
print(" ".join(s[N::-2]+s[N%2::2]))

Submission status: Accepted

Solution code:
N=int(input())
s=list(input().split())
t=s[N::-2]+s[N%2::2]
for i in range(N):
    print(t[i],end=" ")

Submission status: Accepted

Solution code:
N=int(input())
s=list(input().split())
if N>=2:
    t=s[N::-2]+s[N%2::2]
    for i in range(N):
        print(t[i],end=" ")
else:
    print(s[0])

Submission status: Accepted

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

i=n-1
while i>=0:
    b.append(a[i])
    i-=2

i=n%2
while i<n:
    b.append(a[i])
    i+=2

bstr=" ".join(str(x) for x in b)
print(bstr)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def unzip(n, a):
    even_pos = [elem for i, elem in enumerate(a) if i % 2 == 0]
    odd_pos = [elem for i, elem in enumerate(a) if i % 2 == 1]
    if n % 2 == 0:
        return odd_pos[::-1] + even_pos
    else:
        return even_pos[::-1] + odd_pos


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, (input().split())))
    print(' '.join(map(str, unzip(n, a))))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
if n%2 == 0:
    s = a[::-2]+a[::2]
else:
    s = a[::-2]+a[1::2]
print(" ".join(s))

Submission status: Accepted

Solution code:
def c_pushpush(N,A):
    from collections import deque
    # insertをリストの先頭に行うと、リストの要素の再配置に時間がかかる
    b = deque([])
    n_parity = N & 1
    for i in range(N):
        if n_parity == (i + 1) & 1:
            # n,iのパリティが一致
            b.appendleft(A[i])
        else:
            b.append(A[i])
    ans = ' '.join(map(str,b))
    return ans

N = int(input())
A = [int(i) for i in input().split()]
print(c_pushpush(N,A))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
b = [0] * n
for i in range(n % 2, n, 2):
    b[(n + i) // 2] = a[i]
for i in range(n - 1, -1, -2):
    b[(n - i - 1) // 2] = a[i]
print(' '.join(b))

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
a = [int(s) for s in input().split()]

b = deque([])

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

print(' '.join(list(b)))

Submission status: Accepted

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