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:
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

n = i()
a = l()
deq = deque([])
for i in range(n):
    if i%2 == 0:
        deq.append(a[i])
    else:
        deq.appendleft(a[i])
if n%2 == 1:
    deq.reverse()
print(*deq)

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
a = list(map(int, input().split()))
Q = deque(a)
b = deque()
i = 1
while Q:
    q = Q.popleft()
    if i == 0:
        b.appendleft(q)
        i = 1
    else:
        b.append(q)
        i = 0
if n % 2 == 0:
    for bi in b:
        print(bi, end=' ')
    print('')
else:
    for bi in reversed(b):
        print(bi, end=' ')
    print('')

Submission status: Accepted

Solution code:
N=int(input())
*A,=map(int,input().split())
A=A[::-1]
B=[0]*N

i=1
count=0
while count<N:
    if count%2==0:
        B[i-1]=A[count]
    else:
        B[-i]=A[count]
        i+=1
    count+=1

print(*B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    deq = collections.deque()
    for i in range(n):
        if i % 2 == 0:
            deq.append(str(a[i]))
        else:
            deq.appendleft(str(a[i]))
    if n % 2 == 1:
        deq.reverse()
    print(" ".join(deq))
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
from collections import deque

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

d = deque()
for i, value in enumerate(a, start=1):
    if n % 2 == i % 2:
        d.appendleft(value)
    else:
        d.append(value)

for value in d:
    print(f'{value} ', end="")
print()
exit()

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()
b = []
iodd = a[::2]
ieven = a[1::2]
if n % 2 == 0:
    b = ieven[::-1] + iodd
else:
    b = iodd[::-1] + ieven
print(*b)

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
a_li = list(map(int, input().split()))
b_li = deque()
for i in range(len(a_li)):
    if i % 2 == 0:
        b_li.append(a_li[i])
    else:
        b_li.appendleft(a_li[i])

if len(a_li) % 2 == 0:
    print(*b_li)
else:
    print(*list(b_li)[::-1])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
dp=[0]*n
i,j,k=1,1,0
p=n//2
dp[p]=a[0]
if n%2==0:
  while i+j-1!=n:
    if k%2==0:
      dp[p-i]=a[i+j-1]
      i+=1
      k=1
    else:
      dp[p+j]=a[i+j-1]
      j+=1
      k=0
  print(*dp)
else:
  while i+j-1!=n:
    if k%2==0:
      dp[p+i]=a[i+j-1]
      i+=1
      k=1
    else:
      dp[p-j]=a[i+j-1]
      j+=1
      k=0
  print(*dp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,copy,heapq,itertools,math,string
from collections import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = deque()

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

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

c = [a[b[i]] for i in range(n)]
print(*c)

Submission status: Accepted

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

Submission status: Accepted

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

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


ans=left
ans.extend(right)
L=[str(a) for a in ans]
L=" ".join(L)
print(L)

Submission status: Accepted

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

d = deque()
t = 0
for i in a:
  if t == 0: d.append(i)
  elif t == 1: d.appendleft(i)
  t = 1 - t
  
if t == 0: print(*d)
else: print(*list(reversed(d)))

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 == 0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
if n % 2 == 0:
    print(*reversed(b))
else:
    print(*b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
num = list(range(n-1,-(n-1)-2,-2) )
for i in range(len(num)):
    if num[i]<0:
        num[i] = abs(num[i]+1)
    print(a[num[i]], end = ' ')

Submission status: Accepted

Solution code:
from collections import deque
d = deque()
N = int(input())
A = list(map(int, input().split()))

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

if N % 2 == 0:
    print(*d)
else:
    d.reverse()
    print(*d)

Submission status: Accepted

Solution code:
n = int(input())
A = tuple(map(int, input().split()))
ae = A[::2]
ao = A[1::2]

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

Submission status: Accepted

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

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


from collections import deque

n = a_int()
A = ints()
B = deque()
is_fliped = 0
for a in A:
    if is_fliped == 0:
        B.append(a)
    else:
        B.appendleft(a)
    is_fliped = 1 - is_fliped
if is_fliped:
    B.reverse()
print(*B)

Submission status: Accepted

Solution code:
#ABC066-C
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])

result = list(d)
if n % 2 == 1:
    result = reversed(list(d))
print(*result)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    if N % 2 == 0:
        print(*A[1::2][::-1], *A[::2])
    else:
        print(*A[::2][::-1], *A[1::2])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(input().split())
from collections import deque
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(" ".join(d))
else:
  print(" ".join(reversed(d)))

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

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:
    d.reverse()
print(*d)

Submission status: Accepted

Solution code:
from collections import deque

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

b=deque()

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

ans=[]

for elem in b:
    ans.append(elem)

print(*ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque()

# print(a)
rev = False
for i in a:
    if rev:
        b.appendleft(i)
    else:
        b.append(i)
    rev = not rev

if rev:
    b.reverse()

for i in b:
    print(i)

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 == 0:
        B.append(A[i])
    else:
        B.appendleft(A[i])

if n%2:
    B = list(B)[::-1]
        
print(*B)

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

odd = [a[i] for i in range(n) if i % 2 == 0]
even = [a[i] for i in range(n) if i % 2 == 1]

if n % 2 == 1:
   b = odd[::-1]
   b.extend(even)
else:
   b = even[::-1]
   b.extend(odd)
print(*b)

Submission status: Accepted

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


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

print(*b)

Submission status: Accepted

Solution code:
from collections import deque


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

for i, a in enumerate(A):
    if i % 2 == 0:
        B.append(a)
    else:
        B.appendleft(a)

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

Submission status: Accepted

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

# 偶数奇数で最終的な向きを決める
for i in range(n):
    if (i < 2):
        d.append(str(L[i]))
    else:
        if (i % 2 == 0):
            d.appendleft(str(L[i]))
        else:
            d.append(str(L[i]))

if (len(d) % 2 == 0):
    d.reverse()
    print(' '.join(d))
else:
    print(' '.join(d))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, *a = map(int, open(0).read().split())
print(*(a[::-2] + a[n%2::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(input().split())
if n%2==0:  
  b=a[::2]
  a.pop(0)
  c=a[::2]
  c.reverse()
  print(' '.join(c+b))
else:
  b=a[::2]
  a.pop(0)
  c=a[::2]
  b.reverse()
  print(' '.join(b+c))

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
dq = deque()
for i in range(n):
    if i%2:
        dq.appendleft(A[i])
    else:
        dq.append(A[i])
if n%2:
    dq = list(dq)[::-1]
print(*dq)

Submission status: Accepted

Solution code:

n = int(input())

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

b1 = []

b2 = []

for i in range(0,len(a),2):
    b1.append(a[i])
    
for i in range(1,len(a),2):
    b2.append(a[i])
    
if n%2 == 0:
    b2.reverse()
    b2.extend(b1)
    for i in b2:
        print(i,end = " ")
        
else:
    b1.reverse()
    b1.extend(b2)
    for i in b1:
        print(i,end = " ")

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
a = list(map(str, input().split()))
b = deque([])
t = 1
for i in a:
    if t == -1:
        b.appendleft(i)
    else :
        b.append(i)
    t *= -1
if t == -1:
    b.reverse()
print(*b)

Submission status: Accepted

Solution code:
from collections import deque
n=int(input())
S=list(input().split())[::-1]
b=deque([])
for i in range(n//2):
  b.append(S.pop())
  b.appendleft(S.pop())
if n%2:
  b.append(S.pop())
  print(' '.join(list(b)[::-1]))
else:print(' '.join(list(b)))

Submission status: Accepted

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

if n == 1:
    l = list(map(str,l))
    print(" ".join(l))
    exit()
2

ans = []

if n%2 == 0:
    tmp = n
    for j in range(n//2-1):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    ans.append(1)
    tmp = 1
    for j in range(n//2-1):
        tmp += 2
        ans.append(tmp)
else:
    tmp = n
    for j in range(n//2):
        ans.append(tmp)
        tmp -= 2
    ans.append(tmp)
    tmp = 2
    for j in range(n//2):
        ans.append(tmp)
        tmp += 2

ans2 = [0]*n
cnt = 0
for i in ans:
    ans2[cnt] = str(l[i-1])
    cnt += 1


print(" ".join(ans2))

Submission status: Accepted

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

from collections import deque

d = deque()

for i,a in enumerate(A):
    if i % 2 == 0:
        d.append(a)
    else:
        d.appendleft(a)

if n % 2 != 0:
    d.reverse()

for i in d:
    print(i,end=" ")
print()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
A = list(input().split())
a = [int(A[i]) for i in range(n)]

b = deque([])
b_rev = deque([])

for i in range(n):
    if i % 2 == 0:
        b.append(str(A[i]))
        b_rev.appendleft(str(A[i]))
    else:
        b.appendleft(str(A[i]))
        b_rev.append(str(A[i]))
    
if n % 2 == 0:
    print(' '.join(b))
else:
    print(' '.join(b_rev))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
o = []
#とりあえず後ろから1つ飛ばしで並べる。
for i in range(n)[::-2]:
    o.append(a[i])
#前からも1つ飛ばしで並べる。
#被らないように、要素数が奇数の時は、0番目ではなく1番目から並べる
for i in range(n)[n%2::2]:
    o.append(a[i])
print(*o)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import deque
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

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

L = deque()

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

if (N%2):
    print(*L)
else:
    print(*list(L)[::-1])

Submission status: Accepted

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

for i in range(n)[::-2]:
    o.append(a[i])

for i in range(n)[n%2::2]:
    o.append(a[i])
print(*o)

Submission status: Accepted

Solution code:
from collections import deque

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

h = deque([])
for i in range(N):
  if i%2 == 0:
    h.append(As[i])
  else:
    h.appendleft(As[i])
    
if N%2 == 1:
  h.reverse()
  
print(" ".join(map(str,h)))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    odd = a[0::2]
    even = a[1::2]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

from collections import deque

d = deque()
for i,num in enumerate(a):
    if i&1:
        d.appendleft(num)
    else:
        d.append(num)

if n&1:
    d.reverse()

print(*d)

Submission status: Accepted

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

if n % 2 == 1:
    for i in reversed(range(1, n+1, 2)):
        b.append(a[i-1])
    for i in range(2, n, 2):
        b.append(a[i-1])
else:
    for i in reversed(range(2, n+1, 2)):
        b.append(a[i-1])
    for i in range(1, n, 2):
        b.append(a[i-1])
    
print(*b, sep=' ')

Submission status: Accepted

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

l = []

if n == 1:
	print(*L)
	exit()

if n%2 == 0:
	for i in range (0,n//2):
		l.append(L[n-1-2*i])
	for i in range (0,n//2):
		l.append(L[2*i])
else:
	for i in range (0,n//2+1):
		l.append(L[n-1-2*i])
	for i in range (0,n//2):
		l.append(L[2*i+1])

print(*l)

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
a1 = ['']*(n//2 + n%2)
a2 = ['']*(n//2)

for i in range(n):
	if i%2 == 0:
		a1[i//2] = a[i]
	else:
		a2[-i//2] = a[i]

if n%2 != 0 and n != 1:
	ans = ' '.join(a1[::-1]) + ' ' + ' '.join(a2[::-1])
elif n%2 == 0:
	ans = ' '.join(a2) + ' ' + ' '.join(a1)
else:
	ans = a[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

guusuu = []
kisuu = []

for i in range(N):
    if i % 2 == 0:
        guusuu.append(A[i])
    else:
        kisuu.append(A[i])

ret = []
if N % 2 == 0:
    ret = kisuu[::-1] + guusuu
else:
    ret = guusuu[::-1] + kisuu

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

Submission status: Accepted

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

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())
a = list(map(int, input().split()))
ol = []
el = []

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a0 = A.pop(0)
    ans = A[1:n:2][::-1] + [a0] + A[0:n:2]
    if n % 2 == 0:
        print(' '.join([str(a) for a in ans[::-1]]))
    else:
        print(' '.join([str(a) for a in ans]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if (N % 2 == 0):
    FLAG = True
else:
    FLAG = False

even = A_s[1::2]
odd = A_s[0::2]
ans = []


if (FLAG):
    even = even[::-1]
    even.extend(odd)
    ans = even
    
else:
    odd = odd[::-1]
    odd.extend(even)
    ans = odd

ans = map(str, ans)

print(' '.join(ans))

Submission status: Accepted

Solution code:
from collections import deque

N=int(input())
d=deque()
S=list(map(int,input().split()))

revflag=False

for i in range(N):
    if revflag==False:
        d.append(S[i])
        revflag=True
    else:
        d.appendleft(S[i])
        revflag=False
    
if revflag==True:
    d.reverse()

Z=list(d)
Z=[str(a) for a in Z]
Z=" ".join(Z)
print(Z)

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: # 前から
    b[i//2]=str(a[N-1-i])
  else:
    b[N-1-i//2]=str(a[N-1-i])
print(" ".join(b))

Submission status: Accepted

Solution code:
from collections import deque

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = deque([])
    for i, tmp in enumerate(a):
        if i%2 == 0:
            b.append(tmp)
        else:
            b.appendleft(tmp)
    if n%2 == 1:
        b.reverse()
    print(*b)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(*ans)

Submission status: Accepted

Solution code:
from collections import deque
N=int(input())
L=list(input().split())
R=deque()
for i in range(N):
  if i%2==0:
    R.appendleft(L[i])
  else:
    R.append(L[i])
if N%2==0:
  R=reversed(R)
R=list(R)
print(" ".join(R))

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
result = list(reversed(a))[::2]

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

print(*result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=list(map(int,readline().split()))

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

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

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = input()
s = list(map(str,input().strip().split()))

from collections import deque

d = deque()

for i,_s in enumerate(s):
  if i % 2 == 0:
    d.appendleft(_s)
  else:
    d.append(_s)
if len(s) %2 != 0:
  print(" ".join(list(d)))
else:
  print(" ".join(list(deque(reversed(d)))))

Submission status: Accepted

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

Submission status: Accepted

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

from collections import deque

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

print(*b)

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
a = 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) == 1:
    print(' '.join(list(d)[::-1]))
else:
    print(' '.join(list(d)))

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==0:
        b.append(a[i])
    if i%2==1:
        b.appendleft(a[i])

if n%2==1:
    c=deque()
    for i in range(n):
        d=b.pop()
        c.append(d)
    print(*c)
else:
    print(*b)

Submission status: Accepted

Solution code:
from collections import deque


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

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

print(*B)

Submission status: Accepted

Solution code:
# ABC 066 C
N = int(input())
A = input().split()
from collections import deque

tmp = deque([])
for i,a in enumerate(A):
    if i %2!=0:
        tmp.appendleft(a)
    else:
        tmp.append(a)
if N%2!=0:
    tmp.reverse()
print(' '.join(tmp))

Submission status: Accepted

Solution code:
from collections import deque
n=int(input())
a=list(map(int,input().split()))
head=False
d = deque()
for i in range(n):
    if head==True:
        d.appendleft(a[i])
    else:
        d.append(a[i])
    head = not head
if head==True:
    d=list(d)
    print(*d[::-1])
else:
    print(*d)

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(str,input().split()))
lso = ls[::2]
lse = ls[1::2]
if n % 2 == 0:
    ans = lse[::-1] + lso
else:
    ans = lso[::-1] + lse
p =" ".join(ans)
print(p)

Submission status: Accepted

Solution code:
from collections import deque

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

d = deque()

for x in range(N):
    if x % 2 == 0:
        d.append(str(a[x]))
    else:
        d.appendleft(str(a[x]))
if N % 2 == 0:
    print(" ".join(d))
else:
    print(" ".join(reversed(d)))

Submission status: Accepted

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

a = list(input().split())
b = []

q = deque()

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

    
print(" ".join(q))

Submission status: Accepted

Solution code:
n = int(input())

a = list(input().split())

e = []
o = []

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

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

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
x=list(map(int,input().split()))
a=[]
b=[]
for i in range(n):
    if i%2==1:
        b.append(x.pop())
    if i%2==0:
        a.append(x.pop())
b=b[::-1]
print(*(a+b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

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

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

print(" ".join(list(b)))

Submission status: Accepted

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

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==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
if n%2==1:
    b.reverse()

print(*b)