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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

print(*b)

Submission status: Time Limit Exceeded

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

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

print(*b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def solve():
    N = int(input())
    A = input().split()
    b = []
    for i,a in enumerate(A):
        if i%2 == 0:
            b.append(a)
        else:
            b.insert(0, a)

    if N % 2 == 1:
        b.reverse()
    print(' '.join(b))
    
solve()

Submission status: Time Limit Exceeded

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

b = []

for c in a:
    b.append(c)
    b.reverse()
    
print(' '.join(b))

Submission status: Time Limit Exceeded

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

for i in range(0, n):
    b.append(a[i])
    b.reverse()
print(*b)

Submission status: Time Limit Exceeded

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

arr=[]
for a in A:
    arr.append(a)
    arr=arr[::-1]

print(' '.join(arr))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(input().split())
ans=[]
for A in a:
    ans.append(A)
    ans.reverse()
print(*ans,sep=' ')

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
A=list(map(int,input().split()))

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

print(*b)

Submission status: Time Limit Exceeded

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

offset = 0 if N % 2 == 0 else 1
ans = A[0]
for i in range(1, N):
    if (i+offset) % 2 == 0:
        ans = ans + " " + A[i]
    else:
        ans = A[i] + " " + ans

print(ans)

Submission status: Time Limit Exceeded

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

for i in b:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
operateNum = int(input())
inputSequence = input().split()
newSequence = ""
if operateNum % 2 != 0:
  for i in range(operateNum):
    if (i + 1) % 2 != 0:
      newSequence = inputSequence[i] + " " + newSequence
    else:
      newSequence = newSequence + inputSequence[i] + " "
else:
  for i in range(operateNum):
    if (i + 1) % 2 == 0:
      newSequence = inputSequence[i] + " " + newSequence
    else:
      newSequence = newSequence + inputSequence[i] + " "

print(newSequence)

Submission status: Time Limit Exceeded

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 = [a[i]] + b

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

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

B=[]
for i,a in enumerate(A):
  if i%2==0:
    B.append(a)
  else:
    B.insert(0,a)
if N%2==1:
  B=B[::-1]

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

Submission status: Time Limit Exceeded

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

B=[]
for a in A:
  B.append(a)
  B=B[::-1]
print(" ".join(map(str,B)))

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

b = []
for ele in a:
    b.append(ele)
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
b = deque(list())
n = int(input())
alist = list(map(int,input().split()))
for a in alist:
    b.append(a)
    b.reverse()
for i in b:
    print(i, end=' ')

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in a:
    ans = ans + [i]
    ans = ans[::-1]
print(*ans,sep=" ")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
B = []
for n in range(N):
    B.append(A[n])
    B = B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
B = []
for n in range(N):
    B.append(A[n])
    B.reverse()
print(*B)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

Solution code:
n = int(input())
A = input().split()
b = []
for i,a in enumerate(A):
    if i%2==0:
        b.insert(0,a)
    else:
        b.append(a)
print(' '.join(reversed(b)) if n%2==0 else ' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = input().split()
b = []
for a in A:
    b.append(a)
    b.reverse()
print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = input().split()
b = []
for i,a in enumerate(A):
    if i%2==0:
        b.insert(0,a)
    else:
        b.append(a)
print(' '.join(reversed(b)) if len(b)%2==0 else ' '.join(b))

Submission status: Time Limit Exceeded

Solution code:

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

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

ans = []
for i in A:
    ans.append(i)
    ans.reverse()

print(*ans)

Submission status: Time Limit Exceeded

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

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

print(*b)

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

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

b = []
while len(a)>=2:
    b.append(a.pop(0))
    b.insert(0, a.pop(0))

if len(a)==1:
    b.append(a.pop(0))
    b.reverse()
    
print(*b)

Submission status: Time Limit Exceeded

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

b = []

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
a = list(map(int,input().split()))
for x in range(n):
    s.append(a[x])
    s = s[::-1]
print(*s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
a = map(int,input().split())
for x in a:
    s.append(x)
    s = s[::-1]
print(*s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
for x in map(int,input().split()):
    s.append(x)
    s = s[::-1]
print(*s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
for x in map(int,input().split()):
    s += [x]
    s = s[::-1]
print(*s,sep=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
S = []
for i,x in enumerate(map(int,input().split())):
    if i % 2 == 0:
        s.append(x)
        for _ in range(len(s)):
            S.append(s.pop())
    if i % 2 == 1:
        S.append(x)
        for _ in range(len(S)):
            s.append(S.pop())
if len(s) > len(S):print(*s,sep=" ")
else: print(*S,sep=" ")

Submission status: Time Limit Exceeded

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

li=[]
for i in a:
    li.append(i)
    li=li[::-1]
print(*li)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

stack = []

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

Submission status: Time Limit Exceeded

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

stack = []

for i in range(n):
    stack.append(a[i])
    stack.reverse()

print(*stack)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(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 != 0:
    b.reverse()

print(*b, sep=' ')

Submission status: Time Limit Exceeded

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, sep=' ')

Submission status: Time Limit Exceeded

Solution code:
n = int(input().strip())
A = input().strip().split(' ')
ans = ''
for i,a in enumerate(A):
  if i == 0:
    ans = a
  elif i%2 == 0:
    ans += ','+a
  else:
    ans = a+','+ans
if n%2 == 0:
  print(*ans.split(','))
else:
  print(*ans.split(',')[::-1])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
for i in range(0,n,2): print(a.pop(n-i-1),end=" ")
print(*a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans=''
for i in range(n):
  if i==n-1:
    ans+=str(b[i])
  else:
    ans+=str(b[i])+' '
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
L = []
for a in A:
  L.append(a)
  L.reverse()
s = str(L[0])
for i in range(1, len(L)):
  s = s + " " + str(L[i])
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = input().split()
que = [A[0]]
for i in range(1,N):
    if i%2 == 0:
        que.append(A[i])
    else:
        que.insert(0,A[i])
if N%2 == 1:
    que = que[::-1]
for i in range(N):
    print(que[i],end = " ")

Submission status: Time Limit Exceeded

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

b = []
b.append(a[0])

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
anums = [i for i in input().split()]
b = ""
for i in range(n):
    if i % 2 == 0:
        b += anums[i]+" "
    else:
        b = anums[i]+" "+b
print(b if n%2 ==0 or n == 1 else b[::-1])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
anums = [int(i) for i in input().split()]
result = []
for i in range(n):
    result.append(anums[i])
    result.reverse()
print(*result,sep=" ")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

arr = []
for x in a:
    arr.append(x)
    arr.reverse()

print(*arr)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n = int(input())
a = deque(list(map(int,input().split())))
b = []
for i in range(n):
  b.append(a.popleft())
  b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

if (n % 2 == 1) :
    print(' '.join(b_list))
else :
    print(' '.join(reversed(b_list)))



# for i in range(1,n) :
#     if (i % 2 == 0) :
#         b = b + " " + a[i]
#     else :
#         b = a[i] + " " + b
    
# if (n % 2 == 0) :
#     print(b)
# else :
#     arr = b.split()
#     arr = list(reversed(arr))

#     print(' '.join(arr))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=input()
a=list(map(str,input().split()))
result=""
i=0
while i<len(a):
  if len(a)%2!=0:
    if i%2==0:
      result=a[i]+","+result
    else:
      result=result+","+a[i]
  else:
    if i%2==0:
      result=result+","+a[i]
    else:
      result=a[i]+","+result
  #print(result)
  i=i+1

print(*result.replace(",,",",").split(","))

Submission status: Time Limit Exceeded

Solution code:
n=input()
a=list(map(int,input().split()))
result=[]
i=0
while i<len(a):
  if len(a)%2!=0:
    if i%2==0:
      result=[a[i]]+result
    else:
      result=result+[a[i]]
  else:
    if i%2==0:
      result=result+[a[i]]
    else:
      result=[a[i]]+result
  i=i+1

print(*result)

Submission status: Time Limit Exceeded

Solution code:
n=input()
a=list(map(int,input().split()))
result=[]
i=0
while i<len(a):
  if len(a)%2!=0:
    if i%2==0:
      result=[a[i]]+result
    else:
      result=result+[a[i]]
  else:
    if i%2==0:
      result=result+[a[i]]
    else:
      result=[a[i]]+result
  i=i+1

print(*result)

Submission status: Time Limit Exceeded

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

print(*result)

Submission status: Time Limit Exceeded

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

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

print(*b)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    head = []
    hip = []
    if n % 2 == 0:
        for i in range(n-1,-1,-2):
            head.append(a.pop())
            hip = [a.pop()]+hip
    else:
        for i in range(n-1,0,-2):
            head.append(a.pop())
            hip = [a.pop()]+hip
        head.append(a.pop())
        
    print(*(head+hip),sep = " ")
if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    head = []
    hip = []
    for i in range(n-1,-1,-2):
        if a:
            head.append(a.pop())
        if a:
            hip = [a.pop()]+hip
    print(*(head+hip),sep = " ")
if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    head = []
    hip = []
    for i in range(n-1,-1,-2):
        if a:
            head.append(a.pop())
        if a:
            hip.insert(0,a.pop())
    print(*(head+hip),sep = " ")
if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    b = []
    for i in a:
        b.append(i)
        b.reverse()
    print(*b,sep = " ")
if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(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 = b[::-1]
print (" ".join(b))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

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

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = map(int, input().split())
l = []
for a in A:
    l.append(a)
    l.reverse()
print(' '.join(map(str, l)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=list(map(int,input().split()))
o=[]
e=[]
for i in range(N):
    if i%2:
        o=o+[a[i]]
        e=[a[i]]+e
    else :
        o=[a[i]]+o
        e=e+[a[i]]
for i in o if N%2 else e:
    print(i,sep="",end=" ")

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
q = deque('')
n = input()
List = input().split()
for l in List:
    q.append(l)
    q = deque(reversed(q))

for p in q:
    print(p)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve_naive(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        b.append(str(a[i]))
        b.reverse()
    print(" ".join(b))
    return

def solve_(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == 0:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    if n % 2 == 0:
        b.reverse()
    print(" ".join(b))
    return

def solve__(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(" ".join(b))
    return

def solve(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(*b)
    return

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()