Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Dice I

  Write a program to simulate rolling a dice, which can be constructed by the following net.

  As shown in the figures, each face is identified by a different label from 1 to 6.

  Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, and prints the integer on the top face. At the initial state, the dice is located as shown in the above figures.

Input

  In the first line, six integers assigned to faces are given in ascending order of their corresponding labels.

  In the second line, a string which represents a sequence of commands, is given. The command is one of 'E', 'N', 'S' and 'W' representing four directions shown in the above figures.

Output

  Print the integer which appears on the top face after the simulation.

Constraints

$0 \leq $ the integer assigned to a face $ \leq 100$

$0 \leq $ the length of the command $\leq 100$

Sample Input 1

1 2 4 8 16 32
SE

Sample Output 1

8

You are given a dice where 1, 2, 4, 8, 16 are 32 are assigned to a face labeled by 1, 2, ..., 6 respectively. After you roll the dice to the direction S and then to the direction E, you can see 8 on the top face.

Sample Input 2

1 2 4 8 16 32
EESWN

Sample Output 2

32



Sample input:
1 2 4 8 16 32
SE


Sample output:
8

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.numbers = map(int, raw_input().split())
        
    def roll(self, direction):
        if direction == "N":
            before_inds = [0, 1, 5, 4]
            after_inds  = [1, 5, 4, 0]
        elif direction == "S":
            before_inds = [0, 1, 5, 4]
            after_inds  = [4, 0, 1, 5]
        elif direction == "E":
            before_inds = [0, 2, 5, 3]
            after_inds  = [3, 0, 2, 5]
        elif direction == "E":
            before_inds = [0, 2, 5, 3]
            after_inds  = [2, 5, 3, 0]
        else:
            return False
        changed = [self.numbers[i] for i in after_inds]
        for c_i, n_i in enumerate(before_inds):
            self.numbers[n_i] = changed[c_i]
        return True
        
dice = Dice()
for d in raw_input():
    dice.roll(d)
    
print dice.numbers[0]

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# ?????????????????¨????????????
class Dice(object):
	def __init__(self):
		# ???????????????????????°
		# ????????¶???
		self.x = [2, 5]
		self.y = [3, 4]
		self.z = [1, 6]
		SN = {'S': 0, 'N': 1}
		WE = {'W': 0, 'E': 1}
		pass

	def rotate(self, _dir):
		def rot(_k, _r):
			return list(reversed(_r)), _k

		if _dir=='N':
			self.x, self.z = rot(self.x, self.z)
		elif _dir=='S':
			self.z, self.x = rot(self.z, self.x)
		elif _dir=='E':
			self.z, self.y = rot(self.z, self.y)
		elif _dir=='W':
			self.y, self.z = rot(self.y, self.z)
		else:
			pass

	def top(self):
		return self.z[0]


if __name__=="__main__":
	dice = Dice()
	dr = input()
	for d in dr:
		dice.rotate(d)
	print(dice.top())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, n1, n2, n3, n4, n5, n6):
        self.elements = [n1, n2, n3, n4, n5, n6]

    def rotateW(self):
        n5 = self.elements[0]
        n1 = self.elements[2]
        n3 = self.elements[5]
        self.elements[4] = n5
        self.elements[0] = n1
        self.elements[2] = n3

    def rotateN(self):
        n2 = self.elements[0]
        n1 = self.elements[3]
        n4 = self.elements[5]
        self.elements[1] = n2
        self.elements[0] = n1
        self.elements[3] = n4

    def rotateS(self):
        n4 = self.elements[0]
        n1 = self.elements[1]
        n2 = self.elements[5]
        self.elements[3] = n4
        self.elements[0] = n1
        self.elements[1] = n2

    def rotateE(self):
        n3 = self.elements[0]
        n1 = self.elements[4]
        n5 = self.elements[5]
        self.elements[2] = n3
        self.elements[0] = n1
        self.elements[4] = n5

elements = map(int, raw_input().split(" "))
dice = Dice(elements[0], elements[4], elements[2], elements[1], elements[3], elements[5])
rule = raw_input()

for i in rule:
    if i == "S": dice.rotateS()
    elif i == "W": dice.rotateW()
    elif i == "N": dice.rotateN()
    elif i == "E": dice.rotateE()

print(str(dice.elements[0]))

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self):
        self.upside = 1
        self.frontside = 2
        self.rightside = 3
        self.backside = 4
        self.leftside = 5
        self.downside = 6
		
    def throwDice(self,dir):
        up = self.upside
        front = self.frontside
        left = self.leftside
        if dir == "S":
            self.frontside = up
            self.backside = 7-up
            self.downside = front
            self.upside = 7-front
			
        elif dir == "N":
            self.frontside = 7-up
            self.backside = up
            self.downside = 7-front
            self.upside = front
 		
        elif dir == "E":
            self.rightside = up
            self.leftside = 7-up
            self.upside = left
            self.downside = 7-left
		
        elif dir == "W":
            self.rightside = 7-up
            self.leftside = up
            self.upside = 7-left
            self.downside = left
	
    def getUpside(self):
        return self.upside
		
n = list(map(int,input().split()))
com = list(input())

dice = Dice()
for i in range(len(com)):
    dice.throwDice(com[i])

print(n[dice.getUpside()-1])

Submission status: Wrong Answer

Solution code:
class Dice(object):
    """
    6??¢???????????????
    ?????¢???top, ?????¢???bottom???????????\??????4??¢??????????????? north, south, east, west ??¨?????¶???
    """
    def __init__(self, faces):
        # faces???????????????????????¨?????????????????????????????????
        # ???????????? top, south, east, west, north, bottom ????????§????´????????????????????????¨??????????????????????????§???top??????????????£????????????
        self.top = faces[0]
        self.south = faces[1]
        self.east = faces[2]
        self.west = faces[3]
        self.north = faces[4]
        self.bottom = faces[5]

    def rotate(self, dir):
        # ???????????????dir??????????????????????????¢?????????
        # ????????????N, S, E, W???????????????????????????(1??????)??§????????????
        if dir == 'N':
            temp = self.top
            self.top = self.south
            self.south = self.bottom
            self.bottom = self.north
            self.north = temp
        elif dir == 'S':
            temp = self.top
            self.top = self.north
            self.north = self.bottom
            self.bottom = self.south
            self.south = temp
        elif dir == 'E':
            temp = self.top
            self.top = self.west
            self.west = self.bottom
            self.bottom = self.east
            self.east = self.top
        elif dir == 'W':
            temp = self.top
            self.top = self.east
            self.east = self.bottom
            self.bottom = self.west
            self.west = temp

    def get_top_value(self):
        return self.top


if __name__ == '__main__':
    # ??????????????\???
    dice_values = [int(x) for x in input().split(' ')]
    rotations = input()

    # ????????????????????????????????¢?????????
    d = Dice(dice_values)
    for r in rotations:
        d.rotate(r)

    # ?????¢??????????¢????????????????
    print('{0}'.format(d.get_top_value()))

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self):
        self.u=1
        self.w=2
        self.s=3
        self.e=4
        self.n=5
        self.d=6
        self.dic={"W":0,"S":1,"E":2,"N":3}
    
    def __init__(self,u,w,s,e,n,d):
        self.u=u
        self.w=w
        self.s=s
        self.e=e
        self.n=n
        self.d=d
        self.dic={"W":0,"S":1,"E":2,"N":3}

    def rot(self,way):
        if isinstance(way,str):
            way=self.dic[way]

        if(way==0):
            c=u
            self.u=self.e
            self.e=self.d
            self.d=self.w
            self.w=c
        elif way==1:
            c=self.u
            self.u=self.n
            self.n=self.d
            self.d=self.s
            self.s=c
        elif way==2:
            c=self.u
            self.u=self.w
            self.w=self.d
            self.d=self.e
            self.e=c
        else :
            c=self.u
            self.u=self.s
            self.s=self.d
            self.d=self.n
            self.n=c

u,s,e,w,n,d=map(int,input().split())
dice=Dice(u,w,s,e,n,d)
st=input()
for c in st:
    dice.rot(c)
print(dice.u)

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.f,self.e,self.w,self.b,self.n]
        elif order=='S':
            num[0]=self.n
            num[1]=self.b
            num[2]=self.e
            num[3]=self.w
            num[4]=self.f
            num[5]=self.s
            return [self.n,self.b,self.e,self.w,self.f,self.s]

        elif order=='E':
            num[0]=self.w
            num[1]=self.s
            num[2]=self.b
            num[3]=self.f
            num[4]=self.n
            num[5]=self.e
            return [self.w,self.s,self.b,self.f,self.n,self.e]
        else:
            num[0]=self.e
            num[1]=self.s
            num[2]=self.f
            num[3]=self.b
            num[4]=self.n
            num[5]=self.w
            return [self.e,self.s,self.f,self.b,self.n,self.w]
    @classmethod
    def Dice_create(cls,num):
            return cls(num)


num=list(map(int,input().split()))
command=input()
dice=Dice(num)
for i in range(len(command)):
    temp=dice.create(command[i])
    dice=Dice.Dice_create(temp)
print(dice.f)

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.f,self.e,self.w,self.b,self.n]
        elif order=='S':
            return [self.n,self.b,self.e,self.w,self.f,self.s]

        elif order=='E':
            return [self.w,self.s,self.b,self.f,self.n,self.e]
        else:
            return [self.e,self.s,self.f,self.b,self.n,self.w]
    @classmethod
    def Dice_create(cls,num):
            return cls(num)


num=list(map(int,input().split()))
command=input()
dice=Dice(num)
for i in range(len(command)):
    temp=dice.create(command[i])
    dice=Dice.Dice_create(temp)
print(dice.f)

Submission status: Wrong Answer

Solution code:
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.b,self.e,self.w,self.f,self.n]
        elif order=='S':
            return [self.n,self.f,self.e,self.w,self.b,self.s]

        elif order=='E':
            return [self.w,self.s,self.f,self.b,self.n,self.e]
        else:
            return [self.e,self.s,self.b,self.f,self.n,self.w]
    @classmethod
    def Dice_create(cls,num):
            return cls(num)


num=list(map(int,input().split()))
command=input()
dice=Dice(num)
for i in range(len(command)):
    temp=dice.create(command[i])
    dice=Dice.Dice_create(temp)
    print(dice.f,dice.n,dice.e,dice.s,dice.w,dice.b)

Submission status: Wrong Answer

Solution code:
d = [_ for _ in input().split()]                 
                                                 
commands = input()                               
                                                 
for c in commands:                               
  if c == 'E':                                   
    d[0], d[1], d[3], d[5] = d[1], d[5], d[0], d[
3]                                               
  elif c == 'W':                                 
    d[0], d[1], d[3], d[5] = d[3], d[0], d[5], d[
1]                                               
  elif c == 'N':                                 
    d[0], d[2], d[4], d[5] = d[2], d[5], d[0], d[
4]                                               
  elif c == 'S':                                 
    d[0], d[2], d[4], d[5] = d[4], d[0], d[5], d[
2]                                               
                                                 
print(d[0])

Submission status: Wrong Answer

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


class Dice(object):
    def __init__(self,num):
        self.one = num[0]
        self.two = num[1]
        self.three = num[2]
        self.four = num[3]
        self.five = num[4]
        self.six = num[5]

    def move(self,str,state):
        if state == 0:
            if str == 'N':
                return 1
            elif str == 'E':
                return 3
            elif str == 'W':
                return 2
            elif str == 'S':
                return 4
        elif state == 1:
            if str == 'N':
                return 5
            elif str == 'E':
                return 3
            elif str == 'W':
                return 2
            elif str == 'S':
                return 0
        elif state == 2:
            if str == 'N':
                return 1
            elif str == 'E':
                return 0
            elif str == 'W':
                return 5
            elif str == 'S':
                return 4
        elif state == 3:
            if str == 'N':
                return 1
            elif str == 'E':
                return 5
            elif str == 'W':
                return 0
            elif str == 'S':
                return 4
        elif state == 4:
            if str == 'N':
                return 0
            elif str == 'E':
                return 3
            elif str == 'W':
                return 2
            elif str == 'S':
                return 5
        elif state == 5:
            if str == 'N':
                return 4
            elif str == 'E':
                return 3
            elif str == 'W':
                return 2
            elif str == 'S':
                return 1

dice = Dice(n)
status = 0

for i in range(len(s)):
    status = dice.move(s[i],status)

print(n[status])

Submission status: Wrong Answer

Solution code:
class Dice:

    __top = 0
    __front = 1
    __right = 2
    __left = 3
    __back = 4
    __bottom = 5

    def __init__(self, a, b, c, d, e, f):
        self.__dice = [a,b,c,d,e,f]
        self.__dice[Dice.__top] = a
        self.__dice[Dice.__front] = b
        self.__dice[Dice.__right] = c
        self.__dice[Dice.__left] = d
        self.__dice[Dice.__back] = e
        self.__dice[Dice.__bottom] = f

    def S(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top] = dice_before[Dice.__back]
        self.__dice[Dice.__front] = dice_before[Dice.__top]
        self.__dice[Dice.__right] = dice_before[Dice.__right]
        self.__dice[Dice.__left] = dice_before[Dice.__left]
        self.__dice[Dice.__back] == dice_before[Dice.__bottom]
        self.__dice[Dice.__bottom] = dice_before[Dice.__front]

    def E(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top] = dice_before[Dice.__left]
        self.__dice[Dice.__front] = dice_before[Dice.__front]
        self.__dice[Dice.__right] = dice_before[Dice.__top]
        self.__dice[Dice.__left] = dice_before[Dice.__bottom]
        self.__dice[Dice.__back] == dice_before[Dice.__back]
        self.__dice[Dice.__bottom] = dice_before[Dice.__right]

    def W(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top] = dice_before[Dice.__right]
        self.__dice[Dice.__front] = dice_before[Dice.__front]
        self.__dice[Dice.__right] = dice_before[Dice.__bottom]
        self.__dice[Dice.__left] = dice_before[Dice.__top]
        self.__dice[Dice.__back] == dice_before[Dice.__back]
        self.__dice[Dice.__bottom] = dice_before[Dice.__left]

    def N(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top] = dice_before[Dice.__front]
        self.__dice[Dice.__front] = dice_before[Dice.__bottom]
        self.__dice[Dice.__right] = dice_before[Dice.__right]
        self.__dice[Dice.__left] = dice_before[Dice.__left]
        self.__dice[Dice.__back] == dice_before[Dice.__top]
        self.__dice[Dice.__bottom] = dice_before[Dice.__back]

    def top(self):
        return(self.__dice[Dice.__top])

a,b,c,d,e,f = input().split()
dice = Dice(a,b,c,d,e,f)
com = input()
for i in com:
    if i == 'S':
        dice.S()
    elif i == 'E':
        dice.E()
    elif i == 'W':
        dice.W()
    elif i == 'N':
        dice.N()

print(dice.top())

Submission status: Wrong Answer

Solution code:
number = [int(x) for x in input().split()]
#S
#1 -> 2
#2 -> 6
#3 -> 3
#4 -> 4
#5 -> 1
#6 -> 5
order = input()

for i in range(len(order)):
    number_2 = number
    if order[i] == 'S':
        number[0] = number_2[4]
        number[1] = number_2[0]
        number[4] = number_2[5]
        number[5] = number_2[1]
    if order[i] == 'W':
        number[0] = number_2[2]
        number[2] = number_2[5]
        number[3] = number_2[0]
        number[5] = number_2[3]
    if order[i] == 'E':
        number[0] = number_2[3]
        number[2] = number_2[0]
        number[3] = number_2[5]
        number[5] = number_2[2]
    if order[i] == 'N':
        number[0] = number_2[1]
        number[1] = number_2[5]
        number[4] = number_2[0]
        number[5] = number_2[4]

print(number[0])

Submission status: Wrong Answer

Solution code:
dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())

rotate_n =[2,6,4,3,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]

for i in direction:
    result = []
    if i == "N":
        for j in range(6):
            dice[j] = rotate_n[j]
    elif i == "S":
        for j in range(6):
            dice[j] = rotate_s[j]
    elif i == "E":
        for j in range(6):
            dice[j] = rotate_e[j]
    else:
        for j in range(6):
            dice[j] = rotate_w[j]
    for k in dice:
        result.append(number[k-1])
    number = result

print(number[1])

Submission status: Wrong Answer

Solution code:
dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())

rotate_n =[2,6,4,3,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]

for i in direction:
    result = []
    if i == "N":
        for j in range(6):
            dice[j] = rotate_n[j]
    elif i == "S":
        for j in range(6):
            dice[j] = rotate_s[j]
    elif i == "E":
        for j in range(6):
            dice[j] = rotate_e[j]
    else:
        for j in range(6):
            dice[j] = rotate_w[j]
    for k in dice:
        result.append(number[k-1])
    number = result

print(number[0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import sys
import collections
import unittest

def top_face_after_rolling_dice():
    try:
        faces    = [int(num) for num in input().rstrip().split()]
        rollings = input().rstrip()
    except:
        return __input_error()

#    dice = CubicArbitraryValueDice(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5])
#    dice.put(dice.TOP, dice.SOUTH, dice.EAST, dice.WEST, dice.NORTH, dice.BOTTOM)
    
    rollings += "E"
#    for direction in rollings:
#        dice.roll(direction)

#    print(dice.faces[dice.direction[dice.TOP]])
'''
class CubicArbitraryValueDice():
    TOP    = "top"
    BOTTOM = "bottom"
    EAST   = "E"
    WEST   = "W"
    SOUTH  = "S"
    NORTH  = "N"
    OPOSITE_DIRECTION_PAIRS = ( (EAST, WEST), (SOUTH, NORTH) )
    
    #??¢???index??§???????????????????????????
    def __init__(self, n_f0, n_f1, n_f2, n_f3, n_f4, n_f5):
        self.faces = [n_f0, n_f1, n_f2, n_f3, n_f4, n_f5]

    #???????????¢???index?????¢??£??????
    def put(self, dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5):  #?????°????????£?????????
        self.direction = { dir_fi : i for i,dir_fi in enumerate([dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5]) }

    #??¢???index????????´
    def roll(self, direction) : #dirction: (EAST, WEST, SOUTH, NORTH) ??????????????????
        for pair in self.OPOSITE_DIRECTION_PAIRS :
            if direction in pair :
                oposite = pair[0] if (pair[1] == direction) else pair[1]
        
        current = {}
        for direct in (self.TOP, self.BOTTOM, direction, oposite):
            current.update({direct : self.direction[direct]})

        #            direction to bottom,       bottom to oposite,      oposite to top,     top to direction 
        for pair in ((direction, self.BOTTOM), (self.BOTTOM, oposite), (oposite, self.TOP), (self.TOP, direction)):
            self.direction[pair[1]] = current[pair[0]]
'''
def __input_error():
    print("input error")
    return -1
'''
class __TestValueClass(unittest.TestCase):
    def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
        self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
    
    def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
        #tuples[index] = ([*arguments of func], compared value)
        for item in tuples:
            try:
                if isinstance(item[0], collections.Iterable):
                    value = func(*item[0])
                else:
                    value = func(item[0])
                
                if math.isnan(eff_digit) :
                    assertfunc(value,item[1])
                else :
                    format_str = "{0:."+str(eff_digit)+"g}"
                    assertfunc(format_str.format(value),format_str.format(item[1]))
                    
            except Exception as msg:
                swidth = 15
                print("="*50)
                print("-- Assertion Error in '" + func.__name__ + "' --")
                info = []
                info.append(["arguments"     , item[0]    ])
                info.append(["compared value", item[1]    ])
                info.append(["message"       , "\n" + msg ])
                for state in info :
                    print(state[0].ljust(swidth) + ":", state[1])
                sys.exit()

        if print_success :
            print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
#    test = __TestValueClass()
    top_face_after_rolling_dice()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
from sys         import exit
from collections import Iterable
from unittest    import TestCase

#import numpy as np

def top_face_after_rolling_dice():
    try:
        faces    = [int(num) for num in input().rstrip().split()]
        rollings = input().rstrip()
    except:
        return __input_error()
'''
    dice = CubicArbitraryValueDice(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5])
    dice.put(dice.TOP, dice.SOUTH, dice.EAST, dice.WEST, dice.NORTH, dice.BOTTOM)
    
    for operator in rollings:
        dice.roll(operator)

    print(dice.get_value(dice.TOP))

class CubicArbitraryValueDice():
    (TOP, BOTTOM, EAST, WEST, SOUTH, NORTH, RIGHT, LEFT) = ("top", "bottom", "E", "W", "S", "N", "R", "L")
    (stVALUE, stDIRECTION) = ("value", "direction")

    (plus_x, minus_x, plus_y, minus_y, plus_z, minus_z) = ( (1,0,0), (-1,0,0), (0,1,0), (0,-1,0), (0,0,1), (0,0,-1) )

    ROLL_x2y = np.array([ [ 0,-1, 0], [ 1, 0, 0], [ 0, 0, 1] ])
    ROLL_y2x = np.array([ [ 0, 1, 0], [-1, 0, 0], [ 0, 0, 1] ])
    ROLL_y2z = np.array([ [ 1, 0, 0], [ 0, 0,-1], [ 0, 1, 0] ])
    ROLL_z2y = np.array([ [ 1, 0, 0], [ 0, 0, 1], [ 0,-1, 0] ])
    ROLL_z2x = np.array([ [ 0, 0, 1], [ 0, 1, 0], [-1, 0, 0] ])
    ROLL_x2z = np.array([ [ 0, 0,-1], [ 0, 1, 0], [ 1, 0, 0] ])
    
    DIRECTION = { EAST : plus_x,   WEST : minus_x,  NORTH : plus_y,   SOUTH : minus_y,  TOP   : plus_z,   BOTTOM : minus_z }
    OPERATOR  = { EAST : ROLL_z2x, WEST : ROLL_x2z, NORTH : ROLL_z2y, SOUTH : ROLL_y2z, RIGHT : ROLL_y2x, LEFT   : ROLL_x2y }
    
    #??¢???index??§???????????????????????????
    def __init__(self, n_f0, n_f1, n_f2, n_f3, n_f4, n_f5):
        self.info = [ {self.stVALUE: n_fi} for n_fi in [n_f0, n_f1, n_f2, n_f3, n_f4, n_f5]]

    #???????????¢???index?????¢??£??????
    def put(self, dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5):  #?????°????????£?????????
        for (info, dir_fi) in zip(self.info, [dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5]):
            info.update({ self.stDIRECTION : self.DIRECTION[dir_fi]})

    #??¢???index????????´
    def roll(self, operator) : #dirction: (EAST, WEST, SOUTH, NORTH, RIGHT, LEFT) ??????????????????
        for info in self.info:
            info[self.stDIRECTION] = tuple( np.dot(self.OPERATOR[operator], np.array(info[self.stDIRECTION])))

    def get_value(self, direction):
        for info in self.info:
            if info[self.stDIRECTION] == self.DIRECTION[direction] :
                return info[self.stVALUE]
    
    def get_direction(self, value):
        for info in self.info:
            if info[self.stVALUE] == value :
                return info[self.stDIRECTION]

'''
def __input_error():
    print("input error")
    return -1
'''
class __TestValueClass(TestCase):
    def testEqual(self, func, tuples, eff_digit = None, print_success = False):
        self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
    
    def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
        #tuples[index] = ([*arguments of func], compared value)
        for item in tuples:
            try:
                if isinstance(item[0], Iterable):
                    value = func(*item[0])
                else:
                    value = func(item[0])
                
                if eff_digit is None :
                    assertfunc(value,item[1])
                else :
                    format_str = "{0:."+str(eff_digit)+"g}"
                    assertfunc(format_str.format(value),format_str.format(item[1]))
                    
            except Exception as msg:
                swidth = 15
                print("="*50)
                print("-- Assertion Error in '" + func.__name__ + "' --")
                info = []
                info.append(["arguments"     , item[0]    ])
                info.append(["compared value", item[1]    ])
                info.append(["message"       , "\n" + msg ])
                for info_state in info :
                    print(info_state[0].ljust(swidth) + ":", info_state[1])
                exit()

        if print_success :
            print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
#    test = __TestValueClass()
    pass
#    top_face_after_rolling_dice()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
from sys         import exit
from collections import Iterable
from unittest    import TestCase

#import numpy

def top_face_after_rolling_dice():
    try:
        faces    = [int(num) for num in input().rstrip().split()]
        rollings = input().rstrip()
    except:
        return __input_error()

    dice = CubicArbitraryValueDice(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5])
    dice.put(dice.TOP, dice.SOUTH, dice.EAST, dice.WEST, dice.NORTH, dice.BOTTOM)
    
    for operator in rollings:
        dice.roll(operator)

    print(dice.get_value(dice.TOP))
'''
class CubicArbitraryValueDice():
    (TOP, BOTTOM, EAST, WEST, SOUTH, NORTH, RIGHT, LEFT) = ("top", "bottom", "E", "W", "S", "N", "R", "L")
    (stVALUE, stDIRECTION) = ("value", "direction")

    (plus_x, minus_x, plus_y, minus_y, plus_z, minus_z) = ( (1,0,0), (-1,0,0), (0,1,0), (0,-1,0), (0,0,1), (0,0,-1) )

    ROLL_x2y = numpy.array([ [ 0,-1, 0], [ 1, 0, 0], [ 0, 0, 1] ])
    ROLL_y2x = numpy.array([ [ 0, 1, 0], [-1, 0, 0], [ 0, 0, 1] ])
    ROLL_y2z = numpy.array([ [ 1, 0, 0], [ 0, 0,-1], [ 0, 1, 0] ])
    ROLL_z2y = numpy.array([ [ 1, 0, 0], [ 0, 0, 1], [ 0,-1, 0] ])
    ROLL_z2x = numpy.array([ [ 0, 0, 1], [ 0, 1, 0], [-1, 0, 0] ])
    ROLL_x2z = numpy.array([ [ 0, 0,-1], [ 0, 1, 0], [ 1, 0, 0] ])
    
    DIRECTION = { EAST : plus_x,   WEST : minus_x,  NORTH : plus_y,   SOUTH : minus_y,  TOP   : plus_z,   BOTTOM : minus_z }
    OPERATOR  = { EAST : ROLL_z2x, WEST : ROLL_x2z, NORTH : ROLL_z2y, SOUTH : ROLL_y2z, RIGHT : ROLL_y2x, LEFT   : ROLL_x2y }
    
    #??¢???index??§???????????????????????????
    def __init__(self, n_f0, n_f1, n_f2, n_f3, n_f4, n_f5):
        self.info = [ {self.stVALUE: n_fi} for n_fi in [n_f0, n_f1, n_f2, n_f3, n_f4, n_f5]]

    #???????????¢???index?????¢??£??????
    def put(self, dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5):  #?????°????????£?????????
        for (info, dir_fi) in zip(self.info, [dir_f0, dir_f1, dir_f2, dir_f3, dir_f4, dir_f5]):
            info.update({ self.stDIRECTION : self.DIRECTION[dir_fi]})

    #??¢???index????????´
    def roll(self, operator) : #dirction: (EAST, WEST, SOUTH, NORTH, RIGHT, LEFT) ??????????????????
        for info in self.info:
            info[self.stDIRECTION] = tuple( numpy.dot(self.OPERATOR[operator], numpy.array(info[self.stDIRECTION])))

    def get_value(self, direction):
        for info in self.info:
            if info[self.stDIRECTION] == self.DIRECTION[direction] :
                return info[self.stVALUE]
    
    def get_direction(self, value):
        for info in self.info:
            if info[self.stVALUE] == value :
                return info[self.stDIRECTION]

'''
def __input_error():
    print("input error")
    return -1

'''
class __TestValueClass(TestCase):
    def testEqual(self, func, tuples, eff_digit = None, print_success = False):
        self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
    
    def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
        #tuples[index] = ([*arguments of func], compared value)
        for item in tuples:
            try:
                if isinstance(item[0], Iterable):
                    value = func(*item[0])
                else:
                    value = func(item[0])
                
                if eff_digit is None :
                    assertfunc(value,item[1])
                else :
                    format_str = "{0:."+str(eff_digit)+"g}"
                    assertfunc(format_str.format(value),format_str.format(item[1]))
                    
            except Exception as msg:
                swidth = 15
                print("="*50)
                print("-- Assertion Error in '" + func.__name__ + "' --")
                info = []
                info.append(["arguments"     , item[0]    ])
                info.append(["compared value", item[1]    ])
                info.append(["message"       , "\n" + msg ])
                for info_state in info :
                    print(info_state[0].ljust(swidth) + ":", info_state[1])
                exit()

        if print_success :
            print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
#    test = __TestValueClass()
    pass
#    top_face_after_rolling_dice()

Submission status: Wrong Answer

Solution code:
#ITP1_11-A Dice 1
rep={
    "N":[4,0,2,3,5,1],
    "S":[1,5,2,3,0,4],
    "E":[2,1,5,0,4,3],
    "W":[3,1,0,5,4,2]
}

d = input().split(" ")
NSEW = input()
c=[0,0,0,0,0,0]
for i in range(len(NSEW)):
    r=rep[NSEW[i]]
    for j in range(6):
        c[r[j]]=d[j]
    d=c
print(d[0])