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:
#C問題
N = int(input())
A = list(map(int,input().split()))
if N%2 == 0:
    front = []
    back = []
    for i in range(N):
        if i%2 == 1:
            front.append(A[i])
        else:
            back.append(A[i])
    front = front[::-1]
    for i in range(N//2):
        print(front[i],end=" ")
    for i in range(N//2):
        print(back[i],end=" ")
        
else:
    front = []
    back = []
    for i in range(N):
        if i%2 == 0:
            front.append(A[i])
        else:
            back.append(A[i])
    front = front[::-1]
    for i in range(N//2 + 1):
        print(front[i],end=" ")
    for i in range(N//2):
        print(back[i],end=" ")

Submission status: Accepted

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

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

print(*z)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a1=a[0:1]+a[1::2]
a2=a[2::2]

if n % 2 == 1 :
    a2=list(reversed(a2))
    a=a2+a1

elif n % 2 == 0 :
    a1=list(reversed(a1))
    a=a1+a2

for j in a:
    print(j,end=' ')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

from collections import deque

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

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

if n % 2:
    b.reverse()

print(*b)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
if n%2:
    for i in range(n)[::-2]:
        print(a[i],end=' ')
    for i in range(1,n)[::2]:
        print(a[i],end=' ')
    print()
else:
    for i in range(n)[::-2]:
        print(a[i],end=' ')
    for i in range(n)[::2]:
        print(a[i],end=' ')
    print()

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(int, input().split()))
indices = []
m = n
while True:
    indices.append(m)
    m -= 2
    if m < 1:
        break
m = 1 if m == 0 else 2
while len(indices) < n:
    indices.append(m)
    m += 2
    if m > n:
        break
res = [ls[i - 1] for i in indices]
print(*res)

Submission status: Accepted

Solution code:
n=int(input())
a=list(input().split())
b1=[]
b2=[]
if n%2==0:
    for i in range(n):
        if i%2!=0:
            b1.append(a[n-i])
        else:
            b2.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            b1.append(a[n-1-i])
        else:
            b2.append(a[i])

b1.extend(b2)

print(" ".join(b1))

Submission status: Accepted

Solution code:
from collections import deque
b = deque(list())
n = int(input())
alist = list(map(int,input().split()))
num = len(alist)

if num % 2 == 0:
    for i in range(num):
        if i % 2 == 0:
            b.append(alist[i])
        elif i % 2 == 1:
            b.appendleft(alist[i])

elif num % 2 == 1:
    for i in range(num):
        if i % 2 == 1:
            b.append(alist[i])
        elif i % 2 == 0:
            b.appendleft(alist[i])

for i in b:
    print(i, end=' ')

Submission status: Accepted

Solution code:
from collections import defaultdict


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    odd = a[::2]
    even = a[1::2]
    if n % 2:
        ans = odd[::-1] + even
    else:
        ans = even[::-1] + odd
    print(*ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
if n % 2 == 0:
    ans = list(reversed(a[1::2])) + a[0::2]
else:
    ans = list(reversed(a[0::2])) + a[1::2]
for i in ans:
    print(i,end=" ")

Submission status: Accepted

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==n%2:
    B.append(A[i])
  else:
    B.appendleft(A[i])
print(*B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*list(B)[::-1])

Submission status: Accepted

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

if n%2 == 0:
  b = list(reversed(o))+e
else:
  b = list(reversed(e))+o
print(*b)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
odd_b = A[::2]
even_b = A[1::2]
even_b.reverse()
ans = even_b+odd_b
if n%2 == 0:
	print(*ans)
else:
	ans.reverse()
	print(*ans)

Submission status: Accepted

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

odd = A[::2]
even = A[1::2]

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

print(*ans)

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
def main():
    N, *A = open(0).read().split()
    if int(N) & 1:
        B, C = A[::2][::-1], A[1::2]
    else:
        B, C = A[1::2][::-1], A[::2]
    print(" ".join(B), end=" ")
    print(" ".join(C))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
from collections import deque


def main():
    N, *A = map(int, open(0).read().split())
    B, x = deque(), N & 1
    for i, a in enumerate(A, start=x):
        if i & 1:
            B.appendleft(a)
        else:
            B.append(a)
    print(*B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
def main():
    N, *A = open(0).read().split()
    if int(N) & 1:
        B = A[::2][::-1] + A[1::2]
    else:
        B = A[1::2][::-1] + A[::2]
    print(" ".join(B))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
from collections import deque


def main():
    N, *A = open(0).read().split()
    B, x = deque(), int(N) & 1
    for i, a in enumerate(A, start=x):
        if i & 1:
            B.appendleft(a)
        else:
            B.append(a)
    print(*B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
def main():
    N, *A = map(int, open(0).read().split())
    if int(N) & 1:
        B = A[::2][::-1] + A[1::2]
    else:
        B = A[1::2][::-1] + A[::2]
    print(*B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC066C - pushpush (ARC077)
from collections import deque


def main():
    N, *A = map(int, open(0).read().split())
    B, x = deque(), int(N) & 1
    for i, a in enumerate(A, start=x):
        if i & 1:
            B.appendleft(a)
        else:
            B.append(a)
    print(*B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
A = input().split()
if n%2==0:
    print(' '.join(A[1::2][::-1]),end=' ')
    print(' '.join(A[::2]))
else:
    print(' '.join(A[::2][::-1]),end=' ')
    print(' '.join(A[1::2]))

Submission status: Accepted

Solution code:
n = int(input())
A = [int(x) for x in input().split()]
B = A[-1-(1-len(A)%2):0:-2] + [A[0]] + A[1::2]
if len(A) % 2 == 0:
  B.reverse()
print(*B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

from collections import deque

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

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

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

print(*d)

Submission status: Accepted

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

if n%2 == 0:
    ind = 0
    for i in range(0,n-1,2):
        ans[ind] = arr[n-1-i]
        ind += 1
    for i in range(0,n-1,2):
        ans[ind] = arr[i]
        ind += 1
else:
    ind = 0
    for i in range(0,n,2):
        ans[ind] = arr[n-1-i]
        ind += 1
    for i in range(1,n-1,2):
        ans[ind] = arr[i]
        ind += 1

for i in range(n-1):
    print(ans[i],end=" ")
print(ans[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B1, B2 = [], []

if N % 2 == 1:
  for idx in range(0,N,2):
    B1.append(A[N-idx-1])
  for idx in range(1,N,2):
    B2.append(A[idx])
else:
  for idx in range(0,N,2):
    B2.append(A[idx])
  for idx in range(1,N,2):
    B1.append(A[N-idx])
print(' '.join(map(str,B1+B2)))

Submission status: Accepted

Solution code:




def main():

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

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


 





if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections as c

N = int(input())
A = list(map(int, input().split()))
B = c.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):
		if i % 2 == 0:
			B.appendleft(A[i])
		else:
			B.append(A[i])

for b in B:
	print(b, end = " ")
print()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = []
i = n - 1
while i >= 0:
  result.append(a[i])
  i -= 2
i += 1
if i < 0:
  i += 2
while i < n:
  result.append(a[i])
  i += 2
print(*result)

Submission status: Accepted

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

Submission status: Accepted

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

b = []

b_odd = []
b_even = []

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

if len(a)%2==0:
    b_odd.reverse()
    b_odd+=b_even
    print(*b_odd)
else:
    b_even.reverse()
    b_even+=b_odd
    print(*b_even)

Submission status: Accepted

Solution code:
import sys
from collections import deque
input = sys.stdin.readline

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

    for i in range(n):
        if not i&1:
            b.append(a[i])
        else:
            b.appendleft(a[i])
    
    if not n&1:
        for i in range(n-1):
            print(b[i], end=" ")
        print(b[n-1])
    else:
        for i in range(n-1, 0, -1):
            print(b[i], end=" ")
        print(b[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import deque

N = int(input())
A = input().split()
L = len(A)

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

print(' '.join(ans))

Submission status: Accepted

Solution code:
from collections import deque

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

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

print(' '.join(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
if n == 1:
    print(a[0])
    exit()
a_o = a[::2]
a_e = a[1::2]
if n % 2 == 0:
    a_e.reverse()
    print(' '.join(a_e),end = ' ')
    print(' '.join(a_o),end = ' ')
else:
    a_o.reverse()
    print(' '.join(a_o),end = ' ')
    print(' '.join(a_e),end = ' ')

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2], end=' ')
print(*A[N%2::2])

Submission status: Accepted

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

right = []
left = []
for i in range(N):
    if i % 2 == 0:
        right.append(A[i])
    else:
        left.append(A[i])
answer = left[::-1]
answer += right
if N%2 == 1:
  answer = answer[::-1]
print(*answer)

Submission status: Accepted

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

Submission status: Accepted

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

b.extend(c)
if n % 2 == 0:
    b = b[::-1]
print(*b)

Submission status: Accepted

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

print(" ".join([str(A[(-1) ** int(i < (n+1)//2) * (2*(i%((n+1)//2))+1) - int(i >= (n+1)//2) * ((n+1)%2)]) for i in range(n)]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
aaa = na()
b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(aaa[i])
    else:
        b.appendleft(aaa[i])
if n % 2 == 1:
    b.reverse()
print(*b)

Submission status: Accepted

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

Submission status: Accepted

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

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

if n % 2 != 0:
    even.reverse()
    b = even + odd
else:
    odd.reverse()
    b = odd + even

print(*b, sep=' ')

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 % 2 != 1:
            b[N//2+i//2] = a[i]
        else:
            b[N//2-i//2-1] = a[i]
else:
    for i in range(N):
        if i % 2 != 1:
            b[N//2-i//2] = a[i]
        else:
            b[N//2+i//2+1] = a[i]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
A = [int(el) for el in input().split(' ')]
if n % 2 == 0:
    B = A[(n-1):0:-2] + A[0:n:2]
else:
    B = A[(n-1)::-2] + A[1:n:2]

print(' '.join(str(el) for el in B))

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
print(*(l[::-2]+l[n%2::2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = list(input().split())
B = ""
m = n//2
if n%2 == 0:
  for i in range(m):
    B += A[n-1-2*i]
    B += " "
  for i in range(m):
    B += A[i*2]
    B += " "
else:
  for i in range(m+1):
    B += A[n-1-2*i]
    B += " "
  for i in range(m):
    B += A[i*2+1]
    B += " "
print(B[:-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
A = input().split()
que = deque([A[0]])
for i in range(1,N):
    if i%2 == 0:
        que.append(A[i])
    else:
        que.appendleft(A[i])
if N%2 == 1:
    que.reverse()
for i in range(N):
    print(que[i],end = " ")

Submission status: Accepted

Solution code:
from collections import deque

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

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

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

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

Submission status: Accepted

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

b = []

for i in range((n+1)//2):
    #print(i)
    b.append(a[n-1-2*i])

even = False

if n % 2 == 0:
    even = False
else:
    even = True

if even == True:
    for i in range(n//2):
        b.append(a[1+2*i])
else:
    for i in range(n//2):
        b.append(a[2*i])
    

print(*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(s) for s in input().split()]
b = [0] * n
j = 0
for i in range(n):
    b[j] = a[n-1-i]
    j = -j if j < 0 else -j-1
print(*b)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
print(*A[::-2],end=" ")
print(*A[n%2::2])

Submission status: Accepted

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])

if n % 2 == 0:
    print(*list(reversed(d)))
else:
    print(*d)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],end=" ")
print(*A[N%2::2])

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc066/tasks/arc077_a
# C - pushpush

n = int(input().split()[0])
a_list = list(map(int, input().split()))

pre_list = a_list[1::2][::-1]
suf_list = a_list[::2]

b = pre_list + suf_list

if n % 2 == 1:
    b = b[::-1]

ans = ' '.join([str(x) for x in b])

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    odd, even = [], []
    for i in range(N):
        if i % 2 == 0:
            odd.append(A[i])
        else:
            even.append(A[i])
    if N % 2 == 0:
        return even[::-1] + odd
    else:
        return odd[::-1] + even

if __name__ == '__main__':
    output = main()
    print(" ".join(map(str, output)))

Submission status: Accepted

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

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

print(' '.join(dq))

Submission status: Accepted

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

for i in range(N):
    if N%2==0:
        if i%2==0:
            B.append(A[i])
    if N%2==1:
        if i%2==1:
            B.append(A[i])


for i in range(N):
    print(B[i],end=" ")

Submission status: Accepted

Solution code:
n = int(input())
As = input().split()
if n%2 == 0:
  rs = list(reversed(As[1::2])) + As[0::2]
else:
  rs = list(reversed(As[0::2])) + As[1::2]
print(" ".join(rs))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

ans = []
for i in range(n)[::-2]:
    out = a.pop(i)
    ans.append(out)

print(*(ans+a))

Submission status: Accepted

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

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

print(*ans, sep=" ")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import sys
input = sys.stdin.readline


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

    que = deque([])

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

    if len(a) % 2 == 0:
        que.reverse()

    index = 0
    for i in que:
        if index == len(que) - 1:
            print("{}".format(i))
        else:
            print("{} ".format(i), end="")
        index += 1

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import deque

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

for i in range(len(a)):
    if (n-i)%2 == 1:
        b_deque.appendleft(a[i])
    else:
        b_deque.append(a[i])
print(*b_deque)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

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

for i in b:
    print(i, end=' ')

Submission status: Accepted

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

Submission status: Accepted

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

r = True

for i in al:
  if r:
    r = False
    ans.append(i)
  else:
    r = True
    ans.appendleft(i)
s = [str(i) for i in ans]
if len(al) % 2 == 1:
  s.reverse()
print(' '.join(s))

Submission status: Accepted

Solution code:
from collections import deque
ans = deque()
n=int(input())
*l, = map(int,input().split())
r=True
for i in l:
  if r:
    r=False
    ans.append(i)
  else:
    r=True
    ans.appendleft(i)
s = [str(i) for i in ans]
if len(l)%2 == 1:
  s.reverse()
print(' '.join(s))

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * n
i = 0
while i < n:
    if i % 2 == 0:
        ans[i//2] = a[-(i+1)]
    else:
        ans[-(i//2+1)] = a[-(i+1)]
    i += 1
print(" ".join(map(str,ans)))

Submission status: Accepted

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

print (" ".join(a[-1::-2] + a[N%2::2]))

Submission status: Accepted

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

print(*(a[::-2]+a[n%2::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

print(*b)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
import collections

n = int(input())
a = list(map(int, input().split()))
ans = collections.deque()
for i,v in enumerate(a):
    if i%2 == 0:
        ans.appendleft(v)
    else:
        ans.append(v)
if n%2 == 0:
    ans.reverse()
print(*ans)

Submission status: Accepted

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

oddA = A[::2]
evenA = A[1::2]

if N % 2 == 1:
    ans = list(reversed(oddA)) + evenA
else:
    ans = list(reversed(evenA)) + oddA

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=input().split()
print(*(a[::-2]+a[N%2::2]))

Submission status: Accepted

Solution code:
n = int(input())
List = list(map(int,input().split()))
ans = List[-1-n%2::-2]+List[::2]
print(*ans[::(-1)**n],end=" ")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
9753102468
na = n-1
if na%2 == 0:
    nl = na-1
    nr = na
else:
    nl = na
    nr = na-1

b = []
for i in range(nl,0,-2):
    b.append(i)
for i in range(0,nr+1,2):
    b.append(i)

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