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: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    print(min(a+b,b+c,c+a))
    return

#B
def B():
    def check(s):
        x = len(s)
        if x % 2:
            return False
        if s[:x // 2] == s[x // 2:]:
            return True
    s = S()
    for i in range(1,len(s)):
        if check(s[: - i]):
            print(len(s) - i)
            return

#C
def C():
    II()
    a = LI()
    ans1 = a[-1::-2]
    ans2 = a[-2::-2]
    ans = ans1 + ans2
    print(*ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
odd = []
even = []
for i, v in enumerate(a[::-1]):
    if i % 2: odd.append(v)
    else: even.append(v)
print(*(even + odd) if n % 2 else (even + list(reversed(odd))))

Submission status: Wrong Answer

Solution code:
BIGMOD = 10**9+7

def modPow(x,n):
    ans = 1
    while n >= 1:
        if bin( n & 1)==bin(1):
            ans = (ans*x) % BIGMOD
        x = x * x % BIGMOD
        n = n>>1
    return ans % BIGMOD

def modFact(N):
    fact = []
    fact.append(1) #0! = 1
    for i in range(1,N+1):
        a = fact[i-1]*i % BIGMOD
        fact.append(a)
    return fact

def modInvFact(fact):
    invFact = []
    for i in range(1,N+2):
        a = modPow(fact[i-1],BIGMOD-2)
        invFact.append(a)
    return invFact

def modPlus(a,b):
    return (a + b) % BIGMOD

def modMinus(a,b):
    if a-b >= 0:
        return (a - b) % BIGMOD
    else:
        return (a - b + BIGMOD)
    
def modMulti(a,b):
    return a * b % BIGMOD

# fact(n),invFact(r),invFact(n-r)
def nCr(fact,invFact,n,r):
    return (fact[n] * invFact[r] * invFact[n-r] ) %BIGMOD

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

odda = []
evena = []
for i in range(n):
    if i%2 == 0:
        odda.append(a[i])
    else:
        evena.append(a[i])
ans = []
if n%2 == 0:
    evena.reverse()
    for i in range(len(evena)):
        ans.append(evena[i])
    for i in range(len(odda)):
        ans.append(odda[i])
else:
    odda.reverse()
    for i in range(len(odda)):
        ans.append(odda[i])
    for i in range(len(evena)):
        ans.append(evena[i])

print(ans)

Submission status: Wrong Answer

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


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 :
    print(b[::-1])

Submission status: Wrong Answer

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

even,odd=[],[]

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if len(A)%2 == 0:
  B_right = A[0::2]
  B_left = list(reversed(A[1::2]))
else:
  B_middle = A[0]
  B_left = A[2::2]
  B_left.append(B_middle)
  B_right = list(reversed(A[1::2]))

B_left.extend(B_right)
ans = B_left
print(" ".join(map(str, ans)))

Submission status: Wrong Answer

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

n = int(input())
lst = list(map(int, input().rstrip().split()))
b = deque()
parity = n % 2
for i in lst:
    if i % 2 == parity:
        b.appendleft(i)
    else:
        b.append(i)
print(*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

## 愚直に、リストに対し、偶数回目には前から入れて、奇数回目には後ろから入れる、を繰り返してみる

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

B = [A[0]]
for i in range(1,N):
  if i % 2 == 1:
    B = [A[i]] + B
  else:
    B.append(A[i])
    
ans = ' '.join(list(map(str, B)))
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

for i in range(n):
  if(i%2==b):
    print(hoge[i],end=" ")

Submission status: Wrong Answer

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

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

for i in range(n):
  if(i%2==0):
    print(hoge[i],end=" ")

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

if(N==1):
    print(a[0])
elif(N%2==0):
    for i in range(N-1,-1,-2):
        print(a[i],end=' ')
    for i in range(0,N//2,+2):
        print(a[i],end=' ')
    print(a[N-2])
else:
    for i in range(N-1,-1,-2):
        print(a[i],end=' ')
    for i in range(1,N//2,+2):
        print(a[i],end=' ')
    print(a[N-2])

Submission status: Wrong Answer

Solution code:
input()
a=[i for i in input().split()]
if len(a)%2==0:
    print(' '.join(a[-1::-2]) + ' ' + ' '.join(a[::2]))
else:
    print(' '.join(a[-2::-2]) + ' ' + ' '.join(a[::2]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,a=open(0);a=a.split();print(*a[::-2]+a[id(n)%3::2])

Submission status: Wrong Answer

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])
print(*b)

Submission status: Wrong Answer

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

import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    i = len(a) - 1
    while i >= 0:
        print(a[i], end=" ")
        i -= 2

    i = 1 if i == -1 else 0
    while i < len(a):
        print(a[i], end=" ")
        i += 2


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    i = len(a) - 1
    while i >= 0:
        print(a[i], end=" ")
        i -= 2

    i = 1 if i == 0 else 0
    while i < len(a):
        print(a[i], end=" ")
        i += 2


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

def solve():
    n = int(input())
    A = input().split()

    """方針
    A = 0 6 7 6 7 0
    i | b
    ---------------
    1 | 0
    2 | 0 6 (本当は逆で6 0)
    3 | 7 0 6
    4 | 7 0 6 6 (本当は逆で 6 6 0 7)
    5 | 7 7 0 6 6
    6 | 7 7 0 6 6 0 (本当は逆で0 6 6 0 7 7) 

    ・iが偶数のとき、bの後ろにA[i]を追加する
    ・iが奇数のとき、bの前にA[i]を追加する

    上の操作をn回すべてしたあとに、

    ・nが偶数なら答えを反転する
    ・nが奇数なら答えはそのまま

    ただし、A[i]は2桁以上の数字の可能性も考慮すること
    """

    # 1 2 3 -> 3 1 2
    b = []
    for i in range(1, n+1):
        if i%2 == 0:
            b.append(A[i-1])
        else:
            b.insert(0, A[i-1])

    print(b)

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


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

n = int(input())
q = deque(list(input().split()))
s = ""
for i in range(n):
  s += q.popleft()
  s[::-1]
  
print(" ".join(s))

Submission status: Wrong Answer

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.append(a[i])
        else:
            b.insert(0, a[i])
else:
    for i in range(n):
        if i % 2 == 0:
            b.insert(0, a[i])
        else:
            b.append(a[i])
print(b)

Submission status: Wrong Answer

Solution code:
input();*A,=input().split();print(" ".join(A[::-2]+A[::2]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = input().split()
ans = ""
for i in range(n):
    if i%2: ans = nums[i]+ " " + ans
    else: ans += nums[i] + " "
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n%2 == 0:
    x = a[::2]
    y = a[-1::-2]
    ans = y+x
else:
    x = a[::-2]
    y = a[-2::-2]
    ans = x+y

ans = " ".join(ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n%2 == 0:
    a = list(reversed(a_data[1::2]))
    b = a_data[::2]
    print(''.join(a) + ''.join(b))
else:
    a = ''.join(list(reversed(a_data[::2])))
    b = ''.join(a_data[1::2])
    res = a+b
    print(res)

Submission status: Wrong Answer

Solution code:
from collections import deque

n=int(input())

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

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: Wrong Answer

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=B+[A[i]]
        else:
            B=[A[i]]+B
else:
    for i in range(n):
        if i%2==0:
            B=[A[i]]+B
        else:
            B=B+[A[i]]
        

print(B)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

B=[]
for i in range(n):
    if i%2==0:
        B=B+[A[i]]
    else:
        B=[A[i]]+B

print(B)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

B=[]
for i in range(1,n+1):
    C=[]
    B.append(A[i-1])
    for i in B[::-1]:
        C.append(i)
    B=C
    
print(B)

Submission status: Wrong Answer

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

L = [] 
if N % 2 == 0:
    for i in range(1,N//2+1):
        L.append(2 * i)
    L = sorted(L, reverse=True)
    for i in range(1,N//2+1):
        L.append(2 * i - 1)
else:
    for i in range(1,(N + 1)// 2 + 1):
        L.append(2 * i - 1)
    L = sorted(L, reverse=True)
    for i in range(1,(N + 1)// 2):
        L.append(2 * i)
        
ans = [0 for i in range(N)]
for i,j in enumerate(L):
    ans[i] = A[j-1]
print(ans)

Submission status: Wrong Answer

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

B = []
for i in A:
    B.append(i)
    B = list(reversed(B))
print(B)

Submission status: Wrong Answer

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

even = A[1::2]
odd = A[::2]
print(" ".join(even[::-1])+" "+" ".join(odd))

Submission status: Wrong Answer

Solution code:
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
l = IL()

num = ""
ans = str(l[0])
tmp = ""

for i in range(1,N):
	if i%2!=0:
		tmp += " "+str(l[i])
	else:
		num += " "+str(l[i])
if N%2==0:
	print(tmp[::-1]+ans+num)
else:
	print(num[::-1]+ans+tmp)

Submission status: Wrong Answer

Solution code:
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
l = IL()

num = ""
ans = str(l[0])
tmp = ""
if N%2 == 0:
	for i in range(1,N):
		if i%2!=0:
			tmp += " "+str(l[i])
		else:
			num += " "+str(l[i])
else:
	for i in range(1,N):
		if i%2==0:
			tmp += " "+str(l[i])
		else:
			num += " "+str(l[i])
print(tmp[::-1]+ans+num)

Submission status: Wrong Answer

Solution code:
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
l = IL()

ans = str(l[0])
tmp = ""
if N%2 == 0:
	for i in range(1,N):
		if i%2!=0:
			tmp += " "+str(l[i])
		else:
			ans += " "+str(l[i])
else:
	for i in range(1,N):
		if i%2==0:
			tmp += " "+str(l[i])
		else:
			ans += " "+str(l[i])
print(tmp[::-1]+ans)

Submission status: Wrong Answer

Solution code:
str = input()
str2 = input().split()

n = int(str)

b = []
b_rev = []

for i in range(n):
  b.append(str2[i])
  for j in reversed(b):
    b_rev.append(j)
  b = b_rev
  b_rev = []
      
print(b)

Submission status: Wrong Answer

Solution code:
str = input()
str2 = input().split()

n = int(str)

b = []
b_rev = []

for i in range(n):
  print(i)
  b.append(str2[i])
  for j in reversed(b):
    b_rev.append(j)
  b = b_rev
  b_rev = []
      
print(b)

Submission status: Wrong Answer

Solution code:

n = int(input())
a = [int(i) for i in input().split()]
b = []
for i in range(len(a)):
    b.append(a[i])
    b = b[::-1]
print(b)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
if n%2==0:
    x=a[::2]
    y=a[1::2]
    y.reverse()
    b=y+x
    print(b)
else:
    x=a[::2]
    y=a[1::2]
    x.reverse()
    b=x+y
    print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

B = ''
for i in range(N):
  if(i%2 == 0):
    B += A[i]
  else:
    B = A[i] + B
print(' '.join(B))

Submission status: Wrong Answer

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

B = ''
for i in range(N):
  if(i%2 == 0):
    B = A[i] + B
  else:
    B += A[i]
print(B[::-1])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
e = []
o = []
for i in range(n//2):
    o.append(a[i*2])
    e.append(a[i*2+1])
if n % 2 == 1:
    o.append(a[-1])
e = e[::-1]
print(" ".join(e+o))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[str(v) for k,v in enumerate(a) if k%2==0]
c=[str(v) for k,v in enumerate(a) if k%2==1][::-1]
print(" ".join(c+b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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[::-1]))

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

Submission status: Wrong Answer

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

    s = (" ".join(map(str, q)))
    if N % 2 == 1:
        s = s[::-1]
    print(s)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    evens = [ x for i, x in enumerate(a) if i%2==0]
    odds = reversed([ x for i, x in enumerate(a) if i%2==1])

    tail = " ".join(map(str, evens))
    head = " ".join(map(str, odds))

    print(head + " " + tail)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
odd = A[1::2]
odd.reverse()
even = A[0::2]
ans = odd + even
print(' '.join(map(str, ans)))

Submission status: Wrong Answer

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
print(k)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
L=[]
for i in range(n):
  if i%2==0:L.append(l[i])
  else:L.insert(0,l[i])
for j in range(n):
  print(L[j],end=' ')

Submission status: Wrong Answer

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 0 <= mid - deps * diff and mid + deps * diff < n and a_index < n:
    bl[mid - deps * diff] = al[a_index]
    a_index += 1
    bl[mid + deps * diff] = al[a_index]
    a_index += 1
    deps += 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

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

al = np.array(a_tmp,dtype=np.int32)
np.append(al, a_tmp)

bl = np.array([],dtype=np.int32)

for a in al:
    bl = np.append(bl, a)
    bl = np.sort(bl)[::-1]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(" ".join(map(str,x[::-1])), " ".join(map(str,y)))

Submission status: Wrong Answer

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] = L[i]
        else :
            ANS[(N-i)//2] = L[i]
else :
    for i in range(N) :
        if i % 2 != 0 :
            ANS[(N+i)//2] = L[i]
        else :
            ANS[(N-i)//2] = L[i]
        
print(ANS)

Submission status: Wrong Answer

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

print(' '.join(ans1) + ' ' + ' '.join(ans2))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
ans = []
isf = True
for i in range(n):
    if isf:
        ans.append(a[i])
        isf = False
    else:
        ans = [a[i]] + ans
        isf = True

if n % 2 == 1:
    ans.reverse()
print(''.join(ans))

Submission status: Wrong Answer

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=b+list(str(a[i]))
        else:
            b=list(str(a[i]))+b
else:
    for i in range(n):
        if i%2==0:
            b = list(str(a[i])) + b
        else:
            b = b + list(str(a[i]))
for i in range(n):
    print(b[i], end=" ")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 = map(str, l2 + l1)
print(' '.join(answer))

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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]

for i in range(ind_dw-1,ind_up):
    print(b[i],end = ' ')
print()

Submission status: Wrong Answer

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

b = ''

for i in range(n):
    b = b + str(A[i])
    b = b[::-1]

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

Submission status: Wrong Answer

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

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

C=B1[::-1]+B0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 = [a[i]] + b
        
for i in range(n - 1):
    print(b[i], end = " ")
print(b[n - 1], end = "")
print()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(input().split())
if n == 1:
    print(a)
    exit()
b = ''
for i, ai in enumerate(a):
    if i % 2 == 0:
        b += ai
    else:
        b = ai + b
if n % 2 == 1:
    b = b[::-1]
for bi in b[:-1]:
    print(bi + ' ', end='')
print(b[-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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