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:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())|	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
def inpl(): return list(map(int, input().split()))

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

b = a[::2]
c = a[1::2]

if n%2 == 0:
  ans = list(reversed(c)) + b
  print(*ans, sep=" ")
else:
  ans = list(reversed(b)) + c
  print(*ans, sep=" ")

Submission status: Accepted

Solution code:
def solve(n, As):
    odd = As[1::2]
    even = As[::2]
    if n % 2 == 0:
        return " ".join(map(str, odd[::-1] + even))
    else:
        return " ".join(map(str, even[::-1] + odd))

if __name__ == "__main__":
    n = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(n, As))

Submission status: Accepted

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

Submission status: Accepted

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

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

if n%2 == 1:
    b = b[::-1]
print(" ".join(b))

Submission status: Accepted

Solution code:
import collections

def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    q = collections.deque()

    methods = [q.append, q.appendleft]
    for i in range(N):
        methods[i%2](a[i])

    if N%2==1:
        q = list(reversed(q))
    s = (" ".join(map(str, q)))
    print(s)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
odd = A[1::2]
even = A[0::2]

if len(A) % 2 == 0:
    odd.reverse()
    ans = odd + even
else:
    even.reverse()
    ans = even + odd
    
print(' '.join(map(str, ans)))

Submission status: Accepted

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

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

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

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[n//2+i//2]=a[i]
  else:
    ans[n//2-i//2-1]=a[i]

print(str(ans).replace("[","").replace("]","").replace(",","") if n%2 ==0 else str(ans[::-1]).replace("[","").replace("]","").replace(",","") )

Submission status: Accepted

Solution code:
import collections
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
a = ai()
x = lma()
k = [0]*a
s = 0
t = 0
for i in range(a):
    if i%2==0:
        k[s] = x[-1-i]
        s+=1
    else:
        k[-t-1] = x[-1-i]
        t+=1
s = str(k[0])
for i in range(1,a):
    s+=" "+str(k[i])
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
an,a(n-2),          a(n-3) , a(n-1)
"""
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
a = list(map(int,input().split()))
deq = deque()
for i in range(n):
    if (i+1)%2!=0:deq.append(a[i])
    else:deq.appendleft(a[i])
if n%2!=0:deq.reverse()
for i in range(n):print(deq[i],end=' ')
print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = [int(i) for i in input().split()]
odd = []
even = []
for i in range(n):
    if i%2 == 0:
        odd.append(arr[i])
    else:
        even.append(arr[i])
even = even[::-1]
ans = even+odd if n%2 == 0 else (even+odd)[::-1]
for i in range(n):
    if i<n-1:
        print(ans[i],end=" ")
    else:
        print(ans[i])

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.appendleft(a[i])
        
    else:
        b.append(a[i])

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

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

Submission status: Accepted

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

if n % 2 == 0:
    a1 = a[::2]
    a2 = a[1::2]
    a2 = a2[::-1]

    ans = a2 + a1
else:
    a1 = a[::2]
    a1 = a1[::-1]
    a2 = a[1::2]

    ans = a1 + a2

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


abc066_c()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = []
if n % 2 == 0:
    for e in a[n-1::-2]:
        ans.append(str(e))
    for e in a[0::2]:
        ans.append(str(e))
else:
    for e in a[n-1::-2]:
        ans.append(str(e))
    for e in a[1::2]:
        ans.append(str(e))
print(' '.join(ans))

Submission status: Accepted

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

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:
def main():
    n = int(input())
    aa = list(map(int, input().split()))
    bb = [0] * n
    i_bb = 0
    i_aa = n - 1
    while i_aa >= 0:
        bb[i_bb] = aa[i_aa]
        i_aa -= 2
        i_bb += 1
    i_aa += 1
    if i_aa < 0:
        i_aa += 2
    while i_aa < n:
        bb[i_bb] = aa[i_aa]
        i_aa += 2
        i_bb += 1
    print(' '.join(str(b) for b in bb))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
l1=[];l2=[]
for i in range(n):
  if i%2==n%2:l1.append(l[i])
  else:l2.append(l[i])
l2.reverse()
for j in range(len(l1)):
  l2.append(l1[j])
for j in range(n):
  print(l2[j],end=' ')

Submission status: Accepted

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

Submission status: Accepted

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

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

b = [0 for _ in range(n)]
i = 0
j = n - 1

while(j >= 0):
    b[i] = a[j]
    i += 1
    j -= 2

j = 0 if j == -1 else 1

while(i < n):
    b[i] = a[j]
    i += 1
    j += 2

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

Submission status: Accepted

Solution code:
import sys

n = int(input().strip())
al = list(map(int, input().strip().split(" ")))

bl = [0] * n
diff = 1 if n % 2 == 0 else -1
mid = int(n / 2)
bl[mid] = al[0]

deps = 1
a_index = 1
while a_index < n:
    if 0 > mid - deps * diff:
        break
    bl[mid - deps * diff] = al[a_index]
    a_index += 1
    if a_index >= n:
        break

    if mid + deps * diff >= n:
        break
    bl[mid + deps * diff] = al[a_index]
    a_index += 1
    deps += 1

for b in bl:
    sys.stdout.write(str(b) + " ")

Submission status: Accepted

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

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

num = 1 - i

for i in range(num, n, 2):
    print(a[i], end=' ')

print()

Submission status: Accepted

Solution code:
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
from collections import deque
from math import ceil
setrecursionlimit(2147483647)
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

n = int(input())
a = f()

b = deque([a[0]])
i = 0
if n % 2 == 0:
    for i, v in enumerate(a[1:]):
        if i % 2 == 0:
            b.appendleft(v)
        else:
            b.append(v)
else:
    for i, v in enumerate(a[1:]):
            if i % 2 == 0:
                b.append(v)
            else:
                b.appendleft(v)
    
print(*b, sep=' ')

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
print(' '.join(map(str, (A[0::2][::-1]+A[1::2])[::2*(len(A) % 2)-1])))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a = [int(m) for m in a]
rea = []
for i in range(n):
    rea.append([i, a[i]])

rea.sort(reverse=True)
b = []
c = []
for i in range(n):
    if i % 2 == 0:
        b.append([rea[i][0], rea[i][1]])
    else:
        c.append([rea[i][0], rea[i][1]])

c.sort()

nb = []
nc = []
for i in range(len(b)):
    nb.append(b[i][1])
for i in range(len(c)):
    nc.append(c[i][1])
nd = nb + nc
for i in range(n):
    print(nd[i], end = ' ')

Submission status: Accepted

Solution code:
n = int(input())
a = [i for i in input().split()]
outStr = []
if n % 2 == 0:
    for i in reversed(range(int(n/2))):
        outStr += [a[int(i * 2)+1]]
    for i in range(int(n/2)):
        outStr += [a[int(i*2)]]
    print(" ".join(outStr))
else:
    for i in reversed(range(int(n/2)+1)):
        outStr += [a[int(i*2)]]
    for i in range(int(n/2)):
        outStr += [a[int(i*2)+1]]
    print(" ".join(outStr))

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
a1_list = []
a2_list = []
n_list = [0]*n
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a2_list):
        print(i, end="")
        print(" ", end="")
    for i in a1_list:
        if i != a1_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
else:
    for i in range(1,n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a1_list):
        print(i, end="")
        print(" ", end="")
    print(a_list[0], end="")
    print(" ", end="")
    for i in a2_list:
        if i != a2_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)

Submission status: Accepted

Solution code:

from collections import deque
n = input()
dq = deque()
arr = map(int,raw_input().split())
dq.append(arr[0])
ff = 1
for i in range(1,n):
	if ff:
		dq.append(arr[i])
		ff ^= 1
	else:
		dq.appendleft(arr[i])
		ff ^= 1
if ff:
	for i in range(n):
		print dq[i],
else:
	for i in reversed(range(n)):
		print dq[i],

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
num_list = list(map(int,input().split()))
dq =deque()

for i in range(len(num_list)):
    if i%2 == (n-1)%2:
        dq.appendleft(num_list[i])
    else:
        dq.append(num_list[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Cell:
    def __init__(self, entity, next, prev):
        self.entity = entity
        self.next = next
        self.prev = prev


n = int(input())
A = list(map(int, input().split()))
cell = Cell(A[0], None, None)
top = cell
last = cell

cnt = 0
for i in range(1, len(A)):
    cnt += 1
    if i % 2 == 0:
        tmp = last
        last = Cell(A[i], None, last)
        tmp.next = last
    else:
        tmp = top
        top = Cell(A[i], top, None)
        tmp.prev = top

b = []
cell = top
while(True):
    b.append(cell.entity)
    if not(cell.next):
        break
    cell = cell.next
if n % 2 == 1:
    b.reverse()
print(' '.join(map(str, b)))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
A_o,A_e = [],[]
for i in range(n):
    if i % 2 == 0:
        A_o.append(A[i])
    if i % 2 == 1:
        A_e.append(A[i])
if n % 2 == 1:
    B = list(reversed(A_o)) + A_e
elif n % 2 == 0:
    B = list(reversed(A_e)) + A_o
for e in B:
    print(e,"",end = "")

Submission status: Accepted

Solution code:
# encoding: utf-8
n = int(input())
a = list(map(int, input().split()))

b = [0] * n

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

if n % 2: print(" ".join(list(map(str, b))))
else:print(" ".join(list(map(str, reversed(b)))))

Submission status: Accepted

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

x,y = [],[]
for i in range(1,n+1):
    if i % 2 == 0:
        x.append(a[i-1])
    else:
        y.append(a[i-1])
if n % 2 == 0:
    print(" ".join(map(str,x[::-1])), " ".join(map(str,y)))
else:
    print(" ".join(map(str,y[::-1])), " ".join(map(str,x)))

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
ANS = ["" for i in range(N)]

if N % 2 == 0 :
    for i in range(N) :
        if i % 2 == 0 :
            ANS[(N+i)//2] = str(L[i])
        else :
            ANS[(N-i)//2] = str(L[i])
else :
    for i in range(N) :
        if i % 2 != 0 :
            ANS[(N+i)//2] = str(L[i])
        else :
            ANS[(N-i)//2] = str(L[i])
        
print(" ".join(ANS))

Submission status: Accepted

Solution code:
a = int(input())
ar = input().split(" ")
br = [0 for i in range(a)]
n = a // 2
p = 0
if a % 2 == 0:
    t = "L"
else:
    t = "R"
for i,r in enumerate(ar):
    if i == 0:
        br[n] = r
        p += 1
    else:
        if t == "L":
            br[n-p] = r
            t = "R"
            if a % 2 != 0:
                p += 1
        else:
            br[n+p] = r
            t = "L"
            if a % 2 == 0:
                p += 1
print(" ".join(br))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
ans1 = a[1::2]
ans2 = a[0::2]
ans1.reverse()
ans = ans1 + ans2
if n % 2 == 1:
    ans.reverse()

print(' '.join(ans))

Submission status: Accepted

Solution code:
from collections import deque

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

B = deque(maxlen=2*10**5)

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

print(*B)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

ans = str(b[0])
for i in range(n-1):
    ans += " " + str(b[i+1])
print(ans)

Submission status: Accepted

Solution code:
iN = int(input())
aA = input().rstrip().split()


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

Submission status: Accepted

Solution code:
iN = int(input())
aA = [int(_) for _ in input().split()]


if iN == 1:
    print(aA[0])
else:
    print(" " .join([str(_) for _ in aA[-1::-2] + aA[iN%2::2] ]))

Submission status: Accepted

Solution code:
iN = int(input())
aA = [int(_) for _ in input().split()]


if iN == 1:
    print(aA[0])
elif iN % 2 == 0:
    print(" " .join([str(_) for _ in list(reversed(aA[1::2])) + aA[0::2] ]))
else:
    print(" " .join([str(_) for _ in list(reversed(aA[0::2])) + aA[1::2] ]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int, input().split()))
L.reverse()
lim = int(N/2)
if N%2 == 0:
    for i in range(lim):
        print(str(L[2*i]) + ' ', end="")

    L.reverse()
    for i in range(int(N/2)):
        print(str(L[2*i]) + ' ', end="")
else:
    lim += 1
    for i in range(lim):
        print(str(L[2*i]) + ' ', end="")

    L.reverse()
    for i in range(int(N/2)):
        print(str(L[2*i+1]) + ' ', end="")

Submission status: Accepted

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

if n % 2 != 0:
    r, l = a[1::2], a[::2]
else:
    r, l = a[::2], a[1::2]

l.reverse()
print(' '.join(l + r))

Submission status: Accepted

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

#if N % 2 == 0:
a_1 = a[0::2]
a_2 = a[1::2]
if N % 2 == 0:
	ans_list = a_2[::-1] + a_1
else:
	ans_list = a_1[::-1] + a_2

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
b = [None for _ in range(n)]

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

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

Submission status: Accepted

Solution code:
def split_and_change(N, Array):
    Arr1 = Array[0::2]
    Arr2 = Array[1::2]
    if N % 2 == 0:
        return Arr2[::-1] + Arr1
    else:
        return Arr1[::-1] + Arr2
    
print(" ".join(split_and_change(int(input()), input().split())))

Submission status: Accepted

Solution code:
def split_and_change(N, Array):
    Arr1 = [a for ind, a in enumerate(Array) if ind % 2 == 0]
    Arr2 = [a for ind, a in enumerate(Array) if ind % 2 != 0]
    if N % 2 == 0:
        return Arr2[::-1] + Arr1
    else:
        return Arr1[::-1] + Arr2
    
print(" ".join(split_and_change(int(input()), list(map(str, input().split())))))

Submission status: Accepted

Solution code:
N, = map(int, raw_input().split())
a  = raw_input().split()
b  = []
for i in range(N-1, -1, -2):
  b.append(a[i])
for i in range(N%2, N, 2):
  b.append(a[i])
print " ".join(b)

Submission status: Accepted

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

l1 = []
l2 = []
for i, c in enumerate(b):
    if i%2 == 0:
        l1.append(c)
    else:
        l2.append(c)

l2.reverse()
answer = l2 + l1
if n%2 == 1:
    answer.reverse()
answer = list(map(str, answer))
print(' '.join(answer))

Submission status: Accepted

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

r = ''
if len(a) % 2 == 0:
    for i in range(len(a) - 1, 0, -2):
        r += a[i] + ' '
    for i in range(0, len(a), 2):
        r += a[i] + ' '
else:
    for i in range(len(a) - 1, -1, -2):
        r += a[i] + ' '
    for i in range(1, len(a), 2):
        r += a[i] + ' '
print(r[:-1])

Submission status: Accepted

Solution code:
n = int(input())
a = list(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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(str,input().split()))
L1=[]
L2=[]

for i in range(N):
    if i%2==0:
        L1.append(L[i])
    else:
        L2.append(L[i])
if N%2==0:
    L2=L2[::-1]
    ans=" ".join(L2)
    ans=ans+" "+" ".join(L1)
    print(ans)
else:
    L1=L1[::-1]
    ans=" ".join(L1)
    ans=ans+" "+" ".join(L2)
    print(ans)

Submission status: Accepted

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

if n % 2 != 0:
    r = A[1::2]
    l = A[::2]
else:
    r = A[::2]
    l = A[1::2]
l.reverse()
print(" ".join(map(str, l + r)))

Submission status: Accepted

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

s = []

for i in range(n):
	s.append(0)

if n%2==1:
	for i in range(n//2+1):
		s[i]=a[-1-2*i]
	for i in range(n//2):
		s[n//2+1+i]=a[2*i+1]
else:
	for i in range(n//2):
		s[i]=a[-1-2*i]
	for i in range(n//2):
		s[n//2+i]=a[2*i]
s = map(str,s)
print(" ".join(s))

Submission status: Accepted

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

for i in range(0,n):
    list_b[i] = str(list_b[i])
print(" ".join(list_b))

Submission status: Accepted

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

stA=""
if n%2 == 0:
    index = len(listA)-1
    while index > 0:
        if index== len(listA)-1:
            stA +=str(listA[index])
        else:
            stA+=" "+str(listA[index])
        index-=2
    index = 0
    while index < len(listA)-1:
        stA+=" "+str(listA[index])
        index+=2
else:
    index = len(listA)-1
    while index > -1:
        if index == len(listA)-1:
            stA += str(listA[index])
        else:
            stA += " "+str(listA[index])
        index -= 2
    index = 1
    while index < len(listA)-1:
        stA += " "+str(listA[index])
        index += 2
        
print(stA)

Submission status: Accepted

Solution code:
# coding:utf-8

INF = float('inf')


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


N = int(input())
A = inpl()

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

if N % 2 == 1:
    odd.reverse()
    ans = odd + even
    print(' '.join(map(str, ans)))
else:
    even.reverse()
    ans = even + odd
    print(' '.join(map(str, ans)))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

b = [0 for _ in range(10*n)]
ind = 10*n // 2
ind_up = ind-1
ind_dw = ind
tmp = -1
for i in range(n):
    tmp *= -1
    if tmp == 1:
        ind_up += 1
        b[ind_up] = A[i]
    else:
        ind_dw -= 1
        b[ind_dw] = A[i]


if n%2 != 0:
    b = b[::-1]
    dw = ind_dw - 1
    up = ind_up
else:
    dw = ind_dw
    up = ind_up + 1

for i in range(dw,up):
    print(b[i],end = ' ')
print()

Submission status: Accepted

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

if n%2 == 0:
    ans1 = [a[i-1] for i in reversed(range(2,n+1,2))]
    ans2 = [a[i-1] for i in range(1,n+1,2)]
    ans = ans1 + ans2
else:
    ans1 = [a[i-1] for i in reversed(range(1,n+1,2))]
    ans2 = [a[i-1] for i in range(2,n+1,2)]
    ans = ans1 + ans2
    
print(*ans, sep=' ')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input().split()
a = []
b = []
for i in range(n//2):
    b.append(s[i*2+1])
s = s[::2]
if n%2 == 0:
    b.reverse()
    print(" ".join(b+s))
else:
    s.reverse()
    print(" ".join(s+b))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

n = ni()
a = list(li())

ans = deque([])
for i, ai in enumerate(a):
    if i%2 == 0:
        ans.append(ai)
    else:
        ans.appendleft(ai)
        
if n%2 == 1:
    print(*list(ans)[::-1])
else:
    print(*list(ans))

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])
    print(*b)
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())
src = list(map(int,input().split()))

ans = list(reversed(src[1::2])) + src[::2]
if N%2:
    ans.reverse()
print(*ans)

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.append(ai)
    
  else:
    b.appendleft(ai)
    
if n%2 == 1:
  b = list(b)[::-1]
  print(*b)
else:
  print(*b)