s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s073374897 | p02382 | u126322807 | 1494753020 | Python | Python3 | py | Runtime Error | 0 | 0 | 447 | #!/usr/bin/env python
import math
chebyshev = []
n = int(input())
x = input().split()
y = input().split()
for i in range(n):
x[i] = int(x[i])
for i in range(n):
y[i] = int(y[i])
for p in range(3):
total = 0
for i in range(n):
total += (math.fabs(x[i]-y[i]))**(p+1)
distance = total**(1/(p+1))
print("%.5f" % distance)
for i in range(n):
chebyshev.append(math.abs(x[i]-y[i]))
print("%.5f" % max(chebyshev)) |
s402123519 | p02382 | u279605379 | 1495086496 | Python | Python3 | py | Runtime Error | 0 | 0 | 383 | #ITP1_10-D Distance2
n = int(input())
x = float().split(" ")
y = float().split(" ")
d1=0.0
for i in range(n):
d1 += abs(x[i]-y[i])
print(d1)
d2=0.0
for i in range(n):
d2 += (x[i]-y[i])**2
print(d2**0.5)
d3=0.0
for i in range(n):
d3 += (x[i]-y[i])**3
print(d3**(1.0/3.0))
d_inf=0.0
for i in range(n):
if abs(x[i]-y[i])>d_inf:
d_inf = x[i]-y[i]
print(d_inf) |
s056415987 | p02382 | u650790815 | 1496462343 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | def distance(x,y,n):
return sum(abs(x[i]-y[i])**n for i in range(len(n))) **(1/n)
n = int(input())
x = list(map(float,input().split()))
y = list(map(float,input().split()))
for i in range(1,4):
print(distance(x,y,i))
print(max(abs(x[i]-y[i]) for i in range(n))) |
s526052399 | p02382 | u440180827 | 1496468774 | Python | Python3 | py | Runtime Error | 30 | 7944 | 677 | import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
tmp = [[0 for i in range(6)] for j in range(n+1)]
absDiff = abs(x[0]-y[0])
tmp[0][3] = tmp[0][0] = absDiff
tmp[0][4] = tmp[0][1] = absDiff ** 2
tmp[0][5] = tmp[0][2] = absDiff ** 3
max = absDiff
for i in range(1, n, 1):
absDiff = abs(x[i]-y[i])
tmp[i][0] = absDiff
tmp[i][1] = absDiff ** 2
tmp[i][2] = absDiff ** 3
tmp[i][3] = tmp[i-1][3] + tmp[i][0]
tmp[i][4] = tmp[i-1][4] + tmp[i][1]
tmp[i][5] = tmp[i-1][5] + tmp[i][2]
if absDiff > max:
max = absDiff
print(tmp[i][3])
print(math.sqrt(tmp[i][4]))
print(tmp[i][5] ** (1/3))
print(max) |
s434164158 | p02382 | u914146430 | 1500438984 | Python | Python3 | py | Runtime Error | 0 | 0 | 538 | def min_dist(x_b,y_b):
s=0
for x,y in zip(x_b,y_b):
s+=abs(x-y)
return s
def man_dist(x_b,y_b):
s=0
for x, y in zip(x_b,y_b):
s+=(abs(x-y))**2
return s**0.5
def che_dist(x_b,y_b):
s=0
for x,y in zip(x_b,y_b):
s+=(abs(x-y))**3
return s**(1/3)
def anf_dist(x_b,y_b):
s=[abs(x-y) for x,y in zip(x_b,y_b)]
return max(s)
n=int(input())
y_b=list(map(int,input().split()))
print(min_dist(x_b,y_b))
print(man_dist(x_b,y_b))
print(che_dist(x_b,y_b))
print(anf_dist(x_b,y_b)) |
s620365419 | p02382 | u248424983 | 1503038666 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | import math
n=int(input())
xli=list(map(int,input().split())
yli=list(map(int,input().split())
a=0
b=0
c=0
d=0
for x,y in zip(xli,yli):
base = math.fabs(x,y)
a += base
b += base**2
c += base**3
if d < base : d = base
print(a)
print(b**(1/2))
print(c**(1/3))
print(d) |
s120043071 | p02382 | u248424983 | 1503038746 | Python | Python3 | py | Runtime Error | 0 | 0 | 290 | import math
n=int(input())
xli=list(map(int,input().split()))
yli=list(map(int,input().split()))
a=0
b=0
c=0
d=0
for x,y in zip(xli,yli):
base = math.fabs(x,y)
a += base
b += base**2
c += base**3
if d < base : d = base
print(a)
print(b**(1/2))
print(c**(1/3))
print(d) |
s507729461 | p02382 | u248424983 | 1503039006 | Python | Python3 | py | Runtime Error | 0 | 0 | 294 | import math
n=int(input())
xli=list(map(float,input().split())
yli=list(map(float,input().split())
a=0
b=0
c=0
d=0
for x,y in zip(xli,yli):
base = math.fabs(x-y)
a += base
b += base**2
c += base**3
if d < base : d = base
print(a)
print(b**(1/2))
print(c**(1/3))
print(d) |
s734981650 | p02382 | u954858867 | 1503826910 | Python | Python | py | Runtime Error | 0 | 0 | 417 | import math
ni = int(input())
xi = map(int, raw_input().split())
yi = map(int, raw_input().split())
p1 = []
p2 = []
p3 = []
p4 = []
for x, y in zip(xi, yi):
p1.append(abs(x - y))
p2.append(abs(x - y)**2)
p3.append(abs(x - y)**3)
p4.append(abs(x - y))
print '%.6f' % reduce(lambda x, y: x + y,
print '%.6f' % reduce(lambda x, y: x + y,
print '%.6f' % reduce(lambda x, y: x + y,
print '%.6f' % max(p4) |
s378790435 | p02382 | u954858867 | 1503827050 | Python | Python | py | Runtime Error | 0 | 0 | 386 | import math
ni = int(input())
xi = map(int, raw_input().split(
yi = map(int, raw_input().split(
p1 = []
p2 = []
p3 = []
p4 = []
for x, y in zip(xi, yi):
p1.append(abs(x - y))
p2.append(abs(x - y)**2)
p3.append(abs(x - y)**3)
p4.append(abs(x - y))
print '%.8f' % reduce(lambda x,
print '%.8f' % reduce(lambda x,
print '%.8f' % reduce(lambda x,
print '%.8f' % max(p4) |
s335429401 | p02382 | u933096856 | 1505787067 | Python | Python3 | py | Runtime Error | 0 | 0 | 183 | while True:
n = int( input() )
if n==0:
break
a=list(map(int, input().split()))
m=sum(a)/n
s=0
for i in a:
s+=(i-m)**2
print( ( s/n)**0.5 ) |
s830768776 | p02382 | u748921161 | 1509178910 | Python | Python3 | py | Runtime Error | 20 | 8032 | 855 | import math
def str2list(str):
result = []
for value in str.split(' '):
result.append(int(value))
return result
def distance1(n, x, y):
result = 0
for i in range(n):
result += abs(x[i] - y[i])
return result
def distance2(n, x, y):
result = 0
for i in range(n):
result += (x[i] - y[i]) * (x[i] - y[i])
return math.sqrt(result)
def distance3(n, x, y):
result = 0
for i in range(n):
result += math.pow(abs(x[i] - y[i]), 3)
return math.exp(math.log(result)/3)
def distanceInf(n, x, y):
result = 0
for i in range(n):
new_result = abs(x[i] - y[i])
result = new_result if new_result > result else result
return result
n = int(input());
x = str2list(input())
y = str2list(input())
print('%.6f'%distance1(n, x, y))
print('%.6f'%distance2(n, x, y))
print('%.6f'%distance3(n, x, y))
print('%.6f'%distanceInf(n, x, y)) |
s981655504 | p02382 | u748921161 | 1509179389 | Python | Python3 | py | Runtime Error | 0 | 0 | 1711 | import math
def str2list(str):
result = []
for value in str.split(' '):
result.append(int(value))
return result
def distance1(n, x, y):
result = 0
for i in range(n):
result += abs(x[i] - y[i])
return result
def distance2(n, x, y):
result = 0
for i in range(n):
result += (x[i] - y[i]) * (x[i] - y[i])
return math.sqrt(result)
def distance3(n, x, y):
result = 0
for i in range(n):
result += math.pow(abs(x[i] - y[i]), 3)
return math.exp(math.log(result)/3)
def distanceInf(n, x, y):
result = 0
for i in range(n):
new_result = abs(x[i] - y[i])
result = new_result if new_result > result else result
return result
n = int(input());
x = str2list(input())
y = str2list(input())
print('%.6f'%distance1(n, x, y))
print('%.6f'%distance2(n, x, y))
print('%.6f'%distance3(n, x, y))
print('%.6f'%distanceInf(n, x, y))
import math
def str2list(str):
result = []
for value in str.split(' '):
result.append(int(value))
return result
def distance1(n, x, y):
result = 0
for i in range(n):
result += abs(x[i] - y[i])
return result
def distance2(n, x, y):
result = 0
for i in range(n):
result += (x[i] - y[i]) * (x[i] - y[i])
return math.sqrt(result)
def distance3(n, x, y):
result = 0
for i in range(n):
result += math.pow(abs(x[i] - y[i]), 3)
return math.exp(math.log(result)/3)
def distanceInf(n, x, y):
result = 0
for i in range(n):
new_result = abs(x[i] - y[i])
result = new_result if new_result > result else result
return result
n = int(input());
x = str2list(input())
y = str2list(input())
print('%.6f'%distance1(n, x, y))
print('%.6f'%distance2(n, x, y))
print('%.6f'%distance3(n, x, y))
print('%.6f'%distanceInf(n, x, y)) |
s531468532 | p02382 | u748921161 | 1509179413 | Python | Python3 | py | Runtime Error | 20 | 8044 | 855 | import math
def str2list(str):
result = []
for value in str.split(' '):
result.append(int(value))
return result
def distance1(n, x, y):
result = 0
for i in range(n):
result += abs(x[i] - y[i])
return result
def distance2(n, x, y):
result = 0
for i in range(n):
result += (x[i] - y[i]) * (x[i] - y[i])
return math.sqrt(result)
def distance3(n, x, y):
result = 0
for i in range(n):
result += math.pow(abs(x[i] - y[i]), 3)
return math.exp(math.log(result)/3)
def distanceInf(n, x, y):
result = 0
for i in range(n):
new_result = abs(x[i] - y[i])
result = new_result if new_result > result else result
return result
n = int(input());
x = str2list(input())
y = str2list(input())
print('%.6f'%distance1(n, x, y))
print('%.6f'%distance2(n, x, y))
print('%.6f'%distance3(n, x, y))
print('%.6f'%distanceInf(n, x, y)) |
s335474173 | p02382 | u426534722 | 1516026097 | Python | Python3 | py | Runtime Error | 0 | 0 | 327 | from math import *
import numpy as np
input()
P1 = []
P2 = []
P3 = []
for a, b in zip(map(int, input().split()), map(int, input().split())):
t = abs(a - b)
P1.append(t)
P2.append(t ** 2)
P3.append(t ** 3)
print("{:f}".format(sum(P1)))
print(sqrt(sum(P2)))
print(np.cbrt(sum(P3)))
print("{:f}".format(max(P1)))
|
s215620476 | p02382 | u150984829 | 1516427649 | Python | Python3 | py | Runtime Error | 0 | 0 | 178 | n=int(input())
x,y=[list(map(int,input().split()))for in range(2)]
d=[abs(s-t)for s,t in zip(x,y)]
f=lambda n:sum([s**n for s in d])**(1/n)
print(f(1),f(2),f(3),max(d),sep='\n')
|
s430099767 | p02382 | u027874809 | 1523330346 | Python | Python3 | py | Runtime Error | 0 | 0 | 564 | import math
import numpy as np
s = int(input())
all_list = []
for _ in range(2):
all_list.append(list(map(float, input().split())))
p1 = sum([math.fabs(x - y) for x, y in zip(all_list[0], all_list[1])])
p2 = math.sqrt(sum([(math.fabs(x - y))**2 for x, y in zip(all_list[0], all_list[1])]))
p3 = np.cbrt(sum([(math.fabs(x - y))**3 for x, y in zip(all_list[0], all_list[1])]))
pi = max([math.fabs(x - y) for x, y in zip(all_list[0], all_list[1])])
print("{:.6f}".format(p1))
print("{:.6f}".format(p2))
print("{:.6f}".format(p3))
print("{:.6f}".format(pi))
|
s527953400 | p02382 | u682153677 | 1524395031 | Python | Python3 | py | Runtime Error | 0 | 0 | 431 | # -*- coding: utf-8 -*-
import math
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
abs_xy = []
for i in range(n):
abs_xy.append(abs(x[i] - y[i]))
d1 = sum(abs_xy)
d2 = 0
for i in range(n):
d2 += abs_xy * abs_xy
d2 = math.sqrt(d2)
d3 = 0
for i in range(n):
d3 += abs_xy * abs_xy * abs_xy
d3 = math.pow(d3, 1/3)
d = max(abs_xy)
print(d1)
print(d2)
print(d3)
print(d)
|
s873980543 | p02382 | u592529978 | 1526521633 | Python | Python | py | Runtime Error | 0 | 0 | 117 | n=map(int,raw_input().split())
x1, y1, x2, y2 = map(float, raw_input().split())
print ((x1-x2)**2 + (y1-y2)**2)**0.5
|
s420733353 | p02382 | u995990363 | 1528451681 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 | import math
def mink(x,y,p):
return (sum([math.fabs(_x - _y)**p for _x, _y in zip(x,y)]))**(1/p)
n = int(input())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
print(mink(x,y,1))
print(mink(x,y,2))
print(mink(x,y,3))
print(mink(x,y,10**9))
|
s215178484 | p02383 | u869301406 | 1530963392 | Python | Python3 | py | Runtime Error | 0 | 0 | 2187 | class Dice(object):
def __init__(self, d):
self.rows = [d[0], d[4], d[5], d[1]]
self.cols = [d[0], d[2], d[5], d[3]]
def move_next_rows(self):
temp = self.rows.pop(0)
self.rows.append(temp)
self.__update(self.cols, self.rows)
def move_prev_rows(self):
temp = self.rows.pop(3)
self.rows.insert(0, temp)
self.__update(self.cols, self.rows)
def move_next_cols(self):
temp = self.cols.pop(0)
self.cols.append(temp)
self.__update(self.rows, self.cols)
def move_prev_cols(self):
temp = self.cols.pop(3)
self.cols.insert(0, temp)
self.__update(self.rows, self.cols)
def __update(self, x, y):
x[0] = y[0]
x[2] = y[2]
class DiceChecker(object):
def __init__(self, dice1, dice2):
self.dice1 = dice1
self.dice2 = dice2
self.dice1_top = self.dice1.rows[0]
self.dice1_front = self.dice1.rows[3]
def check_same_dice(self):
is_same = False
for _ in range(4):
for _ in range(4):
is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
if is_same_element:
is_same = True
break
self.dice2.move_next_cols()
else:
self.dice2.move_next_rows()
continue
break
if is_same:
print("Yes")
else:
print("No")
def __find_num(self, x, dice):
i = 0
while x != dice.rows[0]:
dice.move_next_rows()
if i > 3:
dice.move_next_cols()
i = 0
i+=1
def __rot(self, dice):
temp = dice.rows[1]
dice.rows[1] = dice.rows[3]
dice.rows[3] = temp
temp = dice.cols[1]
dice.cols[1] = dice.cols[3]
dice.cols[3] = temp
d1 = list(map(int, input().split(" ")))
d2 = list(map(int, input().split(" ")))
dice1 = Dice(d1)
dice2 = Dice(d2)
dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()
|
s634420672 | p02383 | u744506422 | 1540293093 | Python | Python3 | py | Runtime Error | 0 | 0 | 1435 | c1=[int(i) for i in input().split()]
c2=[int(i) for i in input().split()]
d=[(0,0,1),(-1,0,0),(0,1,0),(0,-1,0),(1,0,0),(0,0,-1)]
def crosspro(y,x):
return (y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0])
def north(r):
res=[]
for p in r:
res.append((p[2],p[1],-p[0]))
return res
def south(r):
res=[]
for p in r:
res.append((-p[2],p[1],p[0]))
return res
def east(r):
res=[]
for p in r:
res.append((p[0],p[2],-p[1]))
return res
def west(r):
res=[]
for p in r:
res.append((p[0],-p[2],p[1]))
return res
def left(r):
res=[]
for p in r:
res.append((p[1],-p[0],p[2]))
return res
def right(r):
res=[]
for p in r:
res.append((-p[1],p[0],p[2]))
return res
T=["","N","E","W","S","NN"]
U=["","L","LL","LLL"]
def change(S):
D=d
for i in S:
if i=="N":
D=north(D)
elif i=="E":
D=east(D)
elif i=="W":
D=west(D)
elif i=="S":
D=south(D)
elif i=="L":
D=left(D)
else:
D=right(D)
return D
for i in T:
for j in U:
D=change(i+j)
flag=0
for x in range(6):
for y in range(6):
if d[x]==D[y]:
if c1[x]!=c2[y]:
flag=1
if flag==0:
print("Yes")
exit()
print("No")
|
s908863258 | p02383 | u482227082 | 1558921936 | Python | Python3 | py | Runtime Error | 0 | 0 | 1044 | class Cube:
def __init__(self, u, s, e, w, n, d):
self.u = u
self.s = s
self.e = e
self.w = w
self.n = n
self.d = d
def rotate(self, dic):
if dic == "N":
tmp = self.u
self.u = self.s
self.s = self.d
self.d = self.n
self.n = tmp
elif dic == "E":
tmp = self.u
self.u = self.w
self.w = self.d
self.d = self.e
self.e = tmp
elif dic == "W":
tmp = self.u
self.u = self.e
self.e = self.d
self.d = self.w
self.w = tmp
else:
tmp = self.u
self.u = self.n
self.n = self.d
self.d = self.s
self.s = tmp
def main():
u, s, e, w, n, d = map(int, input().split())
O = input()
cube = Cube(u, s, e, w, n, d)
for i in range(len(O)):
cube.rotate(O[i])
print(cube.u)
if __name__ == '__main__':
main(
|
s263985044 | p02383 | u142359205 | 1559075378 | Python | Python3 | py | Runtime Error | 0 | 0 | 970 | ## サイコロ
d1, d2, d3, d4, d5, d6 = input().split()
dice = {
'1': d1,
'2': d2,
'3': d3,
'4': d4,
'5': d5,
'6': d6
}
spin_dict = {
'1' : {
's' : '6', #上
'n' : '2', #下
'e' : '4', #左
'w' : '3', #右
},
'2' : {
's' : '1', #上
'n' : '6', #下
'e' : '4', #左
'w' : '3', #右
},
'3' : {
's' : '1', #上
'n' : '6', #下
'e' : '2', #左
'w' : '5', #右
},
'4' : {
's' : '1', #上
'n' : '6', #下
'e' : '5', #左
'w' : '2', #右
},
'5' : {
's' : '1', #上
'n' : '6', #下
'e' : '3', #左
'w' : '4', #右
},
'6' : {
's' : '2', #上
'n' : '1', #下
'e' : '4', #左
'w' : '3', #右
},
}
spins = input().split()
num = '1'
for direction in spins:
num = spin_dict[num][direction]
print(dice['num'])
|
s499884854 | p02383 | u142359205 | 1559075637 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | ## サイコロ
d1, d2, d3, d4, d5, d6 = input().split()
dice = {
'1': d1,
'2': d2,
'3': d3,
'4': d4,
'5': d5,
'6': d6
}
spin_dict = {
'1' : {
's' : '6', #上
'n' : '2', #下
'e' : '4', #左
'w' : '3', #右
},
'2' : {
's' : '1', #上
'n' : '6', #下
'e' : '4', #左
'w' : '3', #右
},
'3' : {
's' : '1', #上
'n' : '6', #下
'e' : '2', #左
'w' : '5', #右
},
'4' : {
's' : '1', #上
'n' : '6', #下
'e' : '5', #左
'w' : '2', #右
},
'5' : {
's' : '1', #上
'n' : '6', #下
'e' : '3', #左
'w' : '4', #右
},
'6' : {
's' : '2', #上
'n' : '1', #下
'e' : '4', #左
'w' : '3', #右
},
}
spins = input()
num = '1'
for direction in spins:
num = spin_dict[num][direction]
print(dice[num])
|
s489151136 | p02383 | u535719732 | 1559323836 | Python | Python3 | py | Runtime Error | 0 | 0 | 1053 | class Dice():
def __init__(self,data):
self.number = data
def rota_S(self):
self.number[0],self.number[1],self.number[5],self.number[4] = self.number[1],self.$
def rota_E(self):
self.number[0],self.number[2],self.number[5],self.number[3] = self.number[2],self.$
def rota_W(self):
self.number[0],self.number[3],self.number[5],self.number[2] = self.number[3],self.$
def rota_N(self):
self.number[0],self.number[4],self.number[5],self.number[1] = self.number[4],self.$
def get_top(self):
return self.number[0]
data = list(map(int,input().split()))
opt = input()
mydice = Dice(data)
print(mydice.number)
for c in range(len(opt)):
print(opt[c])
if(opt[c] == "S"): mydice.rota_S()
elif(opt[c] == "E"): mydice.rota_E()
elif(opt[c] == "W"): mydice.rota_W()
elif(opt[c] == "N"): mydice.rota_N()
else: print("something error")
print(mydice.get_top())
|
s292423825 | p02383 | u535719732 | 1559323860 | Python | Python3 | py | Runtime Error | 0 | 0 | 1413 |
GNU nano 2.9.3 a.py
class Dice():
def __init__(self,data):
self.number = data
def rota_S(self):
self.number[0],self.number[1],self.number[5],self.number[4] = self.number[1],self.number[5],self.number[4],self.number[0]
def rota_E(self):
self.number[0],self.number[2],self.number[5],self.number[3] = self.number[2],self.number[5],self.number[3],self.number[0]
def rota_W(self):
self.number[0],self.number[3],self.number[5],self.number[2] = self.number[3],self.number[5],self.number[2],self.number[0]
def rota_N(self):
self.number[0],self.number[4],self.number[5],self.number[1] = self.number[4],self.number[5],self.number[1],self.number[0]
def get_top(self):
return self.number[0]
data = list(map(int,input().split()))
opt = input()
mydice = Dice(data)
print(mydice.number)
for c in range(len(opt)):
print(opt[c])
if(opt[c] == "S"): mydice.rota_S()
elif(opt[c] == "E"): mydice.rota_E()
elif(opt[c] == "W"): mydice.rota_W()
elif(opt[c] == "N"): mydice.rota_N()
else: print("something error")
print(mydice.get_top())
|
s383734497 | p02383 | u881310147 | 1408158037 | Python | Python | py | Runtime Error | 0 | 0 | 1460 | class Dice(object):
def __init__(self, top, south, east, west, north, bottom):
self.top = top
self.south = south
self.east = east
self.west = west
self.north = north
self.bottom = bottom
def rollN(self):
prevN = self.north
prevB = self.bottom
prevS = self.south
self.north = self.top
self.bottom = prevN
self.south = prevB
self.top = prevS
def rollS(self):
prevS = self.south
prevB = self.bottom
prevN = self.north
self.south = top
self.bottom = prevS
self.north = prevB
self.top = prevN
def rollE(self):
prevE = self.east
prevB = self.bottom
prevW = self.west
self.east = self.top
self.bottom = prevE
self.west = prevB
self.top = prevW
def rollW(self):
prevW = self.west
prevB = self.bottom
prevE = self.east
self.west = top
self.bottom = prevW
self.east = prevB
self.top = prevE
diceInit = [int(n) for n in raw_input().split][:6:]
instruction = raw_input()
diceI = Dice(diceInit[0], diceInit[1], diceInit[2], diceInit[3], diceInit[4], diceInit[5])
for item in instruction:
if item == 'N':
diceI.rollN()
elif item == 'E':
diceI.rollE()
elif item == 'W':
diceI.rollW()
elif item == 'S':
diceI.rollS()
print diceI.top |
s340058401 | p02383 | u881310147 | 1408158198 | Python | Python | py | Runtime Error | 0 | 0 | 1462 | class Dice(object):
def __init__(self, top, south, east, west, north, bottom):
self.top = top
self.south = south
self.east = east
self.west = west
self.north = north
self.bottom = bottom
def rollN(self):
prevN = self.north
prevB = self.bottom
prevS = self.south
self.north = self.top
self.bottom = prevN
self.south = prevB
self.top = prevS
def rollS(self):
prevS = self.south
prevB = self.bottom
prevN = self.north
self.south = top
self.bottom = prevS
self.north = prevB
self.top = prevN
def rollE(self):
prevE = self.east
prevB = self.bottom
prevW = self.west
self.east = self.top
self.bottom = prevE
self.west = prevB
self.top = prevW
def rollW(self):
prevW = self.west
prevB = self.bottom
prevE = self.east
self.west = top
self.bottom = prevW
self.east = prevB
self.top = prevE
diceInit = [int(n) for n in raw_input().split()][:6:]
instruction = raw_input()
diceI = Dice(diceInit[0], diceInit[1], diceInit[2], diceInit[3], diceInit[4], diceInit[5])
for item in instruction:
if item == 'N':
diceI.rollN()
elif item == 'E':
diceI.rollE()
elif item == 'W':
diceI.rollW()
elif item == 'S':
diceI.rollS()
print diceI.top |
s649247442 | p02383 | u881310147 | 1408158329 | Python | Python | py | Runtime Error | 0 | 0 | 1462 | class Dice(object):
def __init__(self, top, south, east, west, north, bottom):
self.top = top
self.south = south
self.east = east
self.west = west
self.north = north
self.bottom = bottom
def rollN(self):
prevN = self.north
prevB = self.bottom
prevS = self.south
self.north = self.top
self.bottom = prevN
self.south = prevB
self.top = prevS
def rollS(self):
prevS = self.south
prevB = self.bottom
prevN = self.north
self.south = top
self.bottom = prevS
self.north = prevB
self.top = prevN
def rollE(self):
prevE = self.east
prevB = self.bottom
prevW = self.west
self.east = self.top
self.bottom = prevE
self.west = prevB
self.top = prevW
def rollW(self):
prevW = self.west
prevB = self.bottom
prevE = self.east
self.west = top
self.bottom = prevW
self.east = prevB
self.top = prevE
diceInit = [int(n) for n in raw_input().split()][:6:]
instruction = raw_input()
diceI = Dice(diceInit[0], diceInit[1], diceInit[2], diceInit[3], diceInit[4], diceInit[5])
for item in instruction:
if item == 'N':
diceI.rollN()
elif item == 'E':
diceI.rollE()
elif item == 'W':
diceI.rollW()
elif item == 'S':
diceI.rollS()
print diceI.top |
s305085329 | p02383 | u067975558 | 1423706176 | Python | Python3 | py | Runtime Error | 0 | 0 | 951 | class Dice:
def __init__(self, data):
self.data = data
def move(self, direction):
if direction == 'E':
self.data[0],self.data[3], self.data[5], self.data[2] = \
self.data[3],self.data[5], self.data[2], self.data[0]
elif direction == 'N':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[1],self.data[5], self.data[4], self.data[0]
elif direction == 'S':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[4],self.data[0], self.data[1], self.data[5]
elif direction == 'W':
self.data[0],self.data[2], self.data[5], self.data[3] = \
self.data[2],self.data[5], self.data[3], self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s515462035 | p02383 | u067975558 | 1423706206 | Python | Python3 | py | Runtime Error | 0 | 0 | 951 | class Dice:
def __init__(self, data):
self.data = data
def move(self, direction):
if direction == 'E':
self.data[0],self.data[3], self.data[5], self.data[2] = \
self.data[3],self.data[5], self.data[2], self.data[0]
elif direction == 'N':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[1],self.data[5], self.data[4], self.data[0]
elif direction == 'S':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[4],self.data[0], self.data[1], self.data[5]
elif direction == 'W':
self.data[0],self.data[2], self.data[5], self.data[3] = \
self.data[2],self.data[5], self.data[3], self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s645374640 | p02383 | u297342993 | 1423706303 | Python | Python3 | py | Runtime Error | 0 | 0 | 1189 | class Dice:
def __init__(self, data):
self.data = data
def move(self, direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3],self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[1],self.data[0],self.data[4],self.data[5]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4],self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[2],self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s984847980 | p02383 | u067975558 | 1423706322 | Python | Python3 | py | Runtime Error | 0 | 0 | 950 | class Dice:
def __init__(self, data):
self.data = data
def move(self, direction):
if direction == 'E':
self.data[0],self.data[3], self.data[5], self.data[2] = \
self.data[3],self.data[5], self.data[2], self.data[0]
elif direction == 'N':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[1],self.data[5], self.data[4], self.data[0]
elif direction == 'S':
self.data[0],self.data[1], self.data[5], self.data[4] = \
self.data[4],self.data[0], self.data[1], self.data[5]
elif direction == 'W':
self.data[0],self.data[2], self.data[5], self.data[3] = \
self.data[2],self.data[5], self.data[3], self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s721596649 | p02383 | u823030818 | 1423706378 | Python | Python3 | py | Runtime Error | 0 | 0 | 1139 | class Dice:
def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
"""tmp = self.data[0]
self.data[0] = self.data[3]
self.data[3] = self.data[5]
self.data[5] = self.data[2]
self.data[2] = tmp"""
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif firection == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s790549539 | p02383 | u823030818 | 1423706512 | Python | Python3 | py | Runtime Error | 0 | 0 | 950 | class Dice:
def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif firection == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s288922674 | p02383 | u823030818 | 1423706588 | Python | Python3 | py | Runtime Error | 0 | 0 | 950 | class Dice:
def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif firection == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s713215302 | p02383 | u823030818 | 1423706668 | Python | Python3 | py | Runtime Error | 0 | 0 | 950 | class Dice:
def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s215542630 | p02383 | u823030818 | 1423706977 | Python | Python3 | py | Runtime Error | 0 | 0 | 945 | class Dice:
def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s367519334 | p02383 | u823030818 | 1423707077 | Python | Python3 | py | Runtime Error | 0 | 0 | 933 | def _init_ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s461572633 | p02383 | u823030818 | 1423707166 | Python | Python3 | py | Runtime Error | 0 | 0 | 945 | def _init_ (self,data):
self.data = data
class Dice:
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3].self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4].self.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4].self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2].self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s895132340 | p02383 | u823030818 | 1423707779 | Python | Python3 | py | Runtime Error | 0 | 0 | 946 | def __init__ (self,data):
self.data = data
class Dice:
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3],self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[4],elf.data[5],self.data[1],self.data[0]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4],self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2],self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s749689401 | p02383 | u823030818 | 1423707957 | Python | Python3 | py | Runtime Error | 0 | 0 | 956 | class Dice:
def __init__ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3],self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[1],elf.data[0],self.data[4],self.data[5]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4],self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2],self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
from Dice
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s809308242 | p02383 | u823030818 | 1423708217 | Python | Python3 | py | Runtime Error | 0 | 0 | 936 |
def __init__ (self,data):
self.data = data
def move(self,direction):
if direction == 'E':
self.data[0],self.data[3],self.data[5],self.data[2] = \
self.data[3],self.data[5],self.data[2],self.data[0]
elif direction == 'N':
self.data[0],self.data[4],self.data[5],self.data[1] = \
self.data[1],self.data[0],self.data[4],self.data[5]
elif direction == 'S':
self.data[0],self.data[1],self.data[5],self.data[4] = \
self.data[4],self.data[0],self.data[1],self.data[5]
elif direction == 'W':
self.data[0],self.data[2],self.data[5],self.data[3] = \
self.data[2],self.data[5],self.data[3],self.data[0]
def getTop(self):
return self.data[0]
dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
dice.move(cmd[i])
print(dice.getTop()) |
s785373509 | p02383 | u370429022 | 1426605696 | Python | Python3 | py | Runtime Error | 0 | 0 | 1078 | # 1: top, 2: front, 3: right,
# 4: left, 5: back, 6: bottom
class Dice:
def __init__(self, nums):
self.top, self.front, self.right, self.left, self.back, self.bottom = nums
def roll(self, direction):
if direction == 'E':
self.top, self.right, self.left, self.bottom = self.left, self.top, self.bottom, self.right
return
if direction == 'N':
self.top, self.front, self.back, self.bottom = self.front, self.bottom, self.top, self.back
return
if direction == 'S':
self.top, self.front, self.back, self.bottom = self.back, self.top, self.bottom, self.front
return
if direction == 'W':
self.top, self.right, self.left, self.bottom = self.right, self.bottom, self.top, self.left
return
def get_top(self):
return self.top
if __name__ == '__main__':
nums = [int(i) for i in input().split()]
directions = input()
d = Dice(nums)
for i in len(directions):
d.roll(directions[i])
print(d.get_top()) |
s111494198 | p02383 | u140201022 | 1431447936 | Python | Python | py | Runtime Error | 0 | 0 | 1239 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
#start = time.clock()
ans=chk=0
a=[0,2,5,3]
b=[0,1,5,4]
def rolling(word,dice):
if word=='S':
dice[0],dice[1],dice[5],dice[4]=dice[4],dice[0],dice[1],dice[5]
elif word=='N':
dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
elif word=='W':
dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
else:
dice[0],dice[2],dice[5],dice[3]=dice[3],dice[0],dice[2],dice[5]
return dice
def sortdice(dice1,dice2,p,q):
for i in range(4):
dice1[p[0]],dice1[p[1]],dice1[p[2]],dice1[p[3]]=dice1[p[1]],dice1[p[2]],dice1[p[3]],dice1[p[0]]
for j in range(4):
dice1[q[0]],dice1[q[1]],dice1[q[2]],dice1[q[3]]=dice1[q[1]],dice1[q[2]],dice1[q[3]],dice1[q[0]]
if dice1==dice2:
print 'Yes'
exit()
return 0
l1=map(int,raw_input().split())
l2=map(int,raw_input().split())
sortdice(l1,l2,a,b)
print 'No' |
s319773427 | p02383 | u633068244 | 1433167319 | Python | Python | py | Runtime Error | 0 | 0 | 1309 | import random
class Dice:
def __init__(self, ls):
self.top, self.bottom = ls[0], ls[5]
self.right, self.left = ls[2], ls[3]
self.front, self.back = ls[1], ls[4]
def rot(self, d):
if d == "N":
(self.top, self.back, self.bottom, self.front) = (
self.front, self.top, self.back, self.bottom)
elif d == "S":
(self.top, self.back, self.bottom, self.front) = (
self.back, self.bottom, self.front, self.top)
elif d == "E":
(self.top, self.right, self.bottom, self.left) = (
self.left, self.top, self.right, self.bottom)
elif d == "W":
(self.top, self.right, self.bottom, self.left) = (
self.right, self.bottom, self.left, self.top)
def show(self):
return (self.top, self.bottom, self.right,
self.left, self.front, self.back)
S = set()
N = int(raw_input())
judge = True
for i in xrange(N):
dice = Dice(map(int, raw_input().split()))
s = set()
for loop in xrange(1000):
nums = dice.show()
if nums in S:
judge = False
break
s.add(nums)
dice.rot("NSEW"[random.randint(0, 3)])
if not judge:
break
S |= s
print "Yes" if judge else "No" |
s262089088 | p02383 | u777299405 | 1435836331 | Python | Python3 | py | Runtime Error | 0 | 0 | 1072 | class Dice:
def __init__(self, faces):
self.faces = tuple(faces)
def roll_north(self):
self.faces = (self.faces[1], self.faces[5], self.faces[2],
self.faces[3], self.faces[0], self.faces[4])
def roll_south(self):
self.faces = (self.faces[4], self.faces[0], self.faces[2],
self.faces[3], self.faces[5], self.faces[1])
def roll_west(self):
self.faces = (self.faces[2], self.faces[1], self.faces[5],
self.faces[0], self.faces[4], self.faces[3])
def roll_east(self):
self.faces = (self.faces[3], self.faces[1], self.faces[0],
self.faces[5], self.faces[4], self.faces[2])
def number(self, face_id):
return self.faces[face_id - 1]
dice = Dice(list(map(int, input().split)))
commands = input()
for c in commands:
if c == "N":
dice.roll_north()
elif c == "S":
dice.roll_south()
elif c == "W":
dice.roll_west()
elif c == "E":
dice.roll_east()
print(dice.number(1)) |
s892577209 | p02383 | u609407244 | 1436089353 | Python | Python3 | py | Runtime Error | 0 | 0 | 490 | axis_1 = '0154' * 2 # 2 -> 3
axis_2 = '0253' * 2 # 4 -> 1
axis_3 = '3124' * 2 # 0 -> 5
right = [axis_3, axis_2[::-1], axis_1, axis_1[::-1], axis_2, axis_3[::-1], ]
a = list(map(int, input().split()))
n = int(input())
for _ in range(n):
top, front = map(a.index, map(int, input().split()))
x = '%d%d' % (top, front)
for i, axis in enumerate(right):
if x in axis:
print(a[i])
break
else:
print('------------------')
print(x) |
s875646152 | p02383 | u938745275 | 1440919594 | Python | Python | py | Runtime Error | 0 | 0 | 1324 | class Dice:
def __init__(self, list = map(str, range(1, 7))):
self.top = list[0]
self.front = list[1]
self.right = list[2]
self.left = list[3]
self.back = list[4]
self.bottom = list[5]
def print_all(self):
print "top = " + self.top
print "front = " + self.front
print "right = " + self.right
print "left = " + self.left
print "back = " + self.back
print "bottom = " + self.bottom
def roll_N(self):
temp = self.top
self.top = self.front
self.front = self.bottom
self.bottom = self.back
self.back = temp
def roll_S(self):
temp = self.top
self.top = self.back
self.back = self.bottom
self.bottom = self.front
self.front = temp
def roll_W(self):
temp = self.top
self.top = self.right
self.right = self.bottom
self.bottom = self.left
self.left = temp
def roll_E(self):
temp = self.top
self.top = self.left
self.left = self.bottom
self.bottom = self.right
self.right = temp
my_dice = dice.Dice(raw_input().split(" "))
order = raw_input()
for i in xrange(len(order)):
if order[i] == "E":
my_dice.roll_E()
elif order[i] == "N":
my_dice.roll_N()
elif order[i] == "S":
my_dice.roll_S()
elif order[i] == "W":
my_dice.roll_W()
else:
continue
print my_dice.top |
s663833964 | p02383 | u938745275 | 1440919618 | Python | Python | py | Runtime Error | 0 | 0 | 1324 | class Dice:
def __init__(self, list = map(str, range(1, 7))):
self.top = list[0]
self.front = list[1]
self.right = list[2]
self.left = list[3]
self.back = list[4]
self.bottom = list[5]
def print_all(self):
print "top = " + self.top
print "front = " + self.front
print "right = " + self.right
print "left = " + self.left
print "back = " + self.back
print "bottom = " + self.bottom
def roll_N(self):
temp = self.top
self.top = self.front
self.front = self.bottom
self.bottom = self.back
self.back = temp
def roll_S(self):
temp = self.top
self.top = self.back
self.back = self.bottom
self.bottom = self.front
self.front = temp
def roll_W(self):
temp = self.top
self.top = self.right
self.right = self.bottom
self.bottom = self.left
self.left = temp
def roll_E(self):
temp = self.top
self.top = self.left
self.left = self.bottom
self.bottom = self.right
self.right = temp
my_dice = dice.Dice(raw_input().split(" "))
order = raw_input()
for i in xrange(len(order)):
if order[i] == "E":
my_dice.roll_E()
elif order[i] == "N":
my_dice.roll_N()
elif order[i] == "S":
my_dice.roll_S()
elif order[i] == "W":
my_dice.roll_W()
else:
continue
print my_dice.top |
s797913244 | p02383 | u467309160 | 1443585706 | Python | Python3 | py | Runtime Error | 0 | 0 | 1300 | class Dice:
??
????????def __init__(self, faces):
????????????????self.faces = tuple(faces)
??
????????def roll_north(self):
????????????????self.faces = (self.faces[1], self.faces[5], self.faces[2],
????????????????????????????????????????????self.faces[3], self.faces[0], self.faces[4])
??
????????def roll_south(self):
????????????????self.faces = (self.faces[4], self.faces[0], self.faces[2],
????????????????????????????????????????????self.faces[3], self.faces[5], self.faces[1])
??
????????def roll_west(self):
????????????????self.faces = (self.faces[2], self.faces[1], self.faces[5],
????????????????????????????????????????????self.faces[0], self.faces[4], self.faces[3])
??
????????def roll_east(self):
????????????????self.faces = (self.faces[3], self.faces[1], self.faces[0],
????????????????????????????????????????????self.faces[5], self.faces[4], self.faces[2])
??
????????def number(self, face_id):
????????????????return self.faces[face_id - 1]
??
??
dice = Dice(list(map(int, input().split())))
commands = input()
??
for c in commands:
????????if c == "N":
????????????????dice.roll_north()
????????elif c == "S":
????????????????dice.roll_south()
????????elif c == "W":
????????????????dice.roll_west()
????????elif c == "E":
????????????????dice.roll_east()
print(dice.number(1)) |
s131601599 | p02383 | u224288634 | 1445083468 | Python | Python | py | Runtime Error | 0 | 0 | 735 | class Dice(object):
def __init__(self,List):
self.face=List
def n_spin(List):
temp=List[0]
List[0]=List[1]
List[1]=List[5]
List[5]=List[4]
List[4]=temp
def s_spin(List):
temp=List[0]
List[0]=List[4]
List[4]=List[5]
List[5]=List[1]
List[1]=temp
def e_spin(lList):
temp=List[0]
List[0]=List[3]
List[3]=List[5]
List[5]=List[2]
List[2]=temp
def w_spin(lList):
temp=List[0]
List[0]=List[2]
List[2]=List[5]
List[5]=List[3]
List[3]=temp
dice = Dice(map(int,raw_input().split())
command = list(raw_input())
for k in command:
if k=='N':
dice.n_spin(dice.face)
elif k=='S':
dice.s_spin(dice.face)
elif k=='E':
dice.e_spin(dice.face)
else:
dice.w_spin(dice.face)
print dice.face[0] |
s378146594 | p02383 | u569960318 | 1464764207 | Python | Python3 | py | Runtime Error | 0 | 0 | 1694 | class dice:
def __init__(self,label):
self.d = label
def roll(self,op):
d = self.d
if op=='N': self.d = [d[1],d[5],d[2],d[3],d[0],d[4]]
elif op=='E': self.d = [d[3],d[1],d[0],d[5],d[4],d[2]]
elif op=='W': self.d = [d[2],d[1],d[5],d[0],d[4],d[3]]
elif op=='S': self.d = [d[4],d[0],d[2],d[3],d[5],d[1]]
def print(self):
print(self.d[0])
def print_r_side(self,t,f):
d = self.d
if (t,f)==(d[0],d[1]): print(d[2])
elif (t,f)==(d[0],d[2]): print(d[4])
elif (t,f)==(d[0],d[3]): print(d[1])
elif (t,f)==(d[0],d[4]): print(d[3])
elif (t,f)==(d[1],d[0]): print(d[3])
elif (t,f)==(d[1],d[2]): print(d[0])
elif (t,f)==(d[1],d[3]): print(d[5])
elif (t,f)==(d[1],d[5]): print(d[2])
elif (t,f)==(d[2],d[0]): print(d[1])
elif (t,f)==(d[2],d[1]): print(d[5])
elif (t,f)==(d[2],d[4]): print(d[0])
elif (t,f)==(d[2],d[5]): print(d[4])
elif (t,f)==(d[3],d[0]): print(d[4])
elif (t,f)==(d[3],d[1]): print(d[0])
elif (t,f)==(d[3],d[4]): print(d[5])
elif (t,f)==(d[3],d[5]): print(d[1])
elif (t,f)==(d[4],d[0]): print(d[2])
elif (t,f)==(d[4],d[2]): print(d[5])
elif (t,f)==(d[4],d[3]): print(d[0])
elif (t,f)==(d[4],d[5]): print(d[3])
elif (t,f)==(d[5],d[1]): print(d[3])
elif (t,f)==(d[5],d[2]): print(d[1])
elif (t,f)==(d[5],d[3]): print(d[4])
elif (t,f)==(d[5],d[4]): print(d[2])
label = list(map(int,input().split()))
q = int(input())
d0 = dice(label)
for _ in range(q):
t,f = list(map(int,input().split()))
d0.print_r_side(t,f) |
s166233297 | p02383 | u427088273 | 1466651716 | Python | Python | py | Runtime Error | 0 | 0 | 1031 | class Dice :
def __init__(self,num):
self.num = num
def move_E(self):
self.copy = self.num.copy()
for i,j in zip([0,2,5,3],[3,0,2,5]):
self.num[i] = self.copy[j]
def move_W(self):
self.copy = self.num.copy()
for i,j in zip([0,3,5,2],[2,0,3,5]):
self.num[i] = self.copy[j]
def move_N(self):
self.copy = self.num.copy()
for i,j in zip([0,1,5,4],[1,5,4,0]):
self.num[i] = self.copy[j]
def move_S(self):
self.copy = self.num.copy()
for i,j in zip([0,1,5,4],[4,0,1,5]):
self.num[i] = self.copy[j]
number = list(map(int,input().split()))
#number = [1,2,4,8,16,32]
#print("1 2 3 4 5 6")
# ?????????????????????
dice = Dice(number)
for order in input():
if order == 'S':
dice.move_S()
elif order == 'N':
dice.move_N()
elif order == 'W':
dice.move_W()
else:
dice.move_E()
# ?????????????????¶????????????
#print(dice.num)
print(dice.num[0]) |
s695788319 | p02383 | u358919705 | 1471810077 | Python | Python3 | py | Runtime Error | 0 | 0 | 1996 | class Dice:
def __init__(self, labels):
self.labels = labels
self.up = labels[0]
self.front = labels[1]
self.right = labels[2]
self.left = labels[3]
self.back = labels[4]
self.down = labels[5]
def east(self):
self.up, self.right, self.down, self.left = self.left, self.up, self.right, self.down
self.update_labels()
def north(self):
self.up, self.back, self.down, self.front = self.front, self.up, self.back, self.down
self.update_labels()
def south(self):
self.up, self.front, self.down, self.back = self.back, self.up, self.front, self.down
self.update_labels()
def west(self):
self.up, self.left, self.down, self.right = self.right, self.up, self.left, self.down
self.update_labels()
def clockwise(self):
self.front, self.left, self.back, self.right = self.right, self.front, self.left, self.back
self.update_labels()
def counterclockwise(self):
self.front, self.right, self.back, self.left = self.left, self.front, self.right, self.back
self.update_labels()
def set_up(self, up):
for i in range(6):
if up == self.up:
break
if i % 2:
self.east()
else:
self.north()
def set_front(self, front):
while True:
if front == self.front:
break
self.clockwise()
def update_labels(self):
self.labels = [self.up, self.front, self.right, self.left, self.back, self.down]
dice_1 = Dice(list(map(int, input().split())))
dice_2 = Dice(list(map(int, input().split())))
flag = False
for i in range(30):
if dice_1.labels == dice_2.labels:
flag = True
break
if i % 5 == 0:
if i % 10 == 0:
dice_2.east()
else:
dice_2.north()
else:
dice_2.clockwise()
if flag:
print('Yes')
else:
print('No') |
s939349597 | p02383 | u998435601 | 1473777756 | Python | Python3 | py | Runtime Error | 0 | 0 | 820 | # 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]
def view(self):
print("x, y, z =", self.x, self.y, self.z)
if __name__=="__main__":
val = list(map(int, input().split()))
dice = Dice()
dr = input()
for d in dr:
dice.rotate(d)
print(val(dice.top())) |
s260131759 | p02383 | u391228754 | 1476175819 | Python | Python3 | py | Runtime Error | 0 | 0 | 1437 | class Dice:
def __init__(self, faces):
self.faces = tuple(faces)
def roll_north(self):
self.faces = (self.faces[1], self.faces[5], self.faces[2],
self.faces[3], self.faces[0], self.faces[4])
def roll_south(self):
self.faces = (self.faces[4], self.faces[0], self.faces[2],
self.faces[3], self.faces[5], self.faces[1])
def roll_west(self):
self.faces = (self.faces[2], self.faces[1], self.faces[5],
self.faces[0], self.faces[4], self.faces[3])
def roll_east(self):
self.faces = (self.faces[3], self.faces[1], self.faces[0],
self.faces[5], self.faces[4], self.faces[2])
def roll_roll(self):
self.faces = (self.faces[0], self.faces[2], self.faces[4],
self.faces[1], self.faces[3], self.faces[5])
def number(self, face_id):
return self.faces[face_id - 1]
def is_same(self, anotherDice):
if self.faces == anotherDice.faces:
return True
return False
dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))
flag = False
for i in range(4):
dice2.roll_north()
for j in range(4):
dice2.roll_roll()
if dice2.is_same(dice1):
flag = True
break
if flag:
break
if flag:
print("Yes")
else:
print("No") |
s506648171 | p02383 | u831244171 | 1478272489 | Python | Python3 | py | Runtime Error | 0 | 0 | 972 | 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])
|
s462125031 | p02383 | u831244171 | 1478272515 | Python | Python3 | py | Runtime Error | 0 | 0 | 975 | 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])
|
s397068474 | p02383 | u831244171 | 1478322745 | Python | Python3 | py | Runtime Error | 0 | 0 | 1475 | def whatIsRight(u,f):
r = 0
if u == 1:
if f == 2:
r = 3
elif f == 3:
r = 5
elif f == 4:
r = 2
elif f == 5:
r = 4
return r
if u == 2:
if f == 6:
r = 3
elif f == 3:
r = 1
elif f == 1:
r = 4
elif f == 4:
r = 6
return r
if u == 3:
if f == 5:
r = 1
elif f == 1:
r = 2
elif f == 2:
r = 6
elif f == 6:
r = 3
return r
if u == 4:
if f == 6:
r = 2
elif f == 2:
r = 1
elif f == 1:
r = 5
elif f == 5:
r = 6
return r
if u == 5:
if f == 3:
r = 6
elif f == 6:
r = 4
elif f == 4:
r = 1
elif f == 1:
r = 3
return r
if u == 6:
if f == 5:
r = 3
elif f == 3:
r = 2
elif f == 2:
r = 4
elif f == 4:
r = 5
return r
n = list(map(int,input().split()))
N = int(input())
for i in range(N):
m = list(map(int,input().split()))
num = []
for j in range(len(m)):
for k in range(len(n)):
if m[j] == n[k]:
num.append(k+1)
break
print(n[whatIsRight(num[0],num[1]) -1]) |
s326095950 | p02383 | u801346721 | 1479113117 | Python | Python3 | py | Runtime Error | 0 | 0 | 1051 | a = list(map(int, input().split()))
O = input()
class dice():
def __init__(self, dice):
self.dice = dice
def S():
one = self.dice[4]
two = self.dice[0]
five = self.dice[5]
six = self.dice[1]
InsSN(one, two, five, six)
def InsSN(one, two, five, six):
self.dice[0] = one
self.dice[1] = two
self.dice[4] = five
self.dice[5] = six
def N():
one = self.dice[1]
two = self.dice[5]
five = self.dice[0]
six = self.dice[4]
InsSN(one, two, five, six)
def InsWE(one, three, four, six):
self.dice[0] = one
self.dice[2] = three
self.dice[4] = four
self.dice[5] = six
def W():
one = self.dice[2]
three = self.dice[5]
four = self.dice[0]
six = self.dice[3]
InsWE(one, three, four, six)
def E():
one = self.dice[3]
three = self.dice[0]
four = self.dice[5]
six = self.dice[2]
InsWE(one, three, four, six)
di = dice(a)
for i in range(len(O)):
if O[i] == 'S':
di.S()
elif O[i] == 'N':
di.N()
elif O[i] == 'E':
di.E()
elif O[i] == 'W':
di.W()
print(di.dice[0])
|
s878480299 | p02383 | u801346721 | 1479113201 | Python | Python3 | py | Runtime Error | 0 | 0 | 1045 | a = list(map(int, input().split()))
O = input()
class Dice():
def __init__(self, d):
self.dice = d
def S():
one = self.dice[4]
two = self.dice[0]
five = self.dice[5]
six = self.dice[1]
InsSN(one, two, five, six)
def InsSN(one, two, five, six):
self.dice[0] = one
self.dice[1] = two
self.dice[4] = five
self.dice[5] = six
def N():
one = self.dice[1]
two = self.dice[5]
five = self.dice[0]
six = self.dice[4]
InsSN(one, two, five, six)
def InsWE(one, three, four, six):
self.dice[0] = one
self.dice[2] = three
self.dice[4] = four
self.dice[5] = six
def W():
one = self.dice[2]
three = self.dice[5]
four = self.dice[0]
six = self.dice[3]
InsWE(one, three, four, six)
def E():
one = self.dice[3]
three = self.dice[0]
four = self.dice[5]
six = self.dice[2]
InsWE(one, three, four, six)
di = Dice(a)
for i in range(len(O)):
if O[i] == 'S':
di.S()
elif O[i] == 'N':
di.N()
elif O[i] == 'E':
di.E()
elif O[i] == 'W':
di.W()
print(di.dice[0])
|
s200233044 | p02383 | u801346721 | 1479113358 | Python | Python3 | py | Runtime Error | 0 | 0 | 1073 | a = list(map(int, input().split()))
O = input()
class Dice():
def __init__(self, d):
self.dice = d
def S(self):
one = self.dice[4]
two = self.dice[0]
five = self.dice[5]
six = self.dice[1]
InsSN(one, two, five, six)
def InsSN(self, one, two, five, six):
self.dice[0] = one
self.dice[1] = two
self.dice[4] = five
self.dice[5] = six
def N(self):
one = self.dice[1]
two = self.dice[5]
five = self.dice[0]
six = self.dice[4]
InsSN(one, two, five, six)
def InsWE(self, one, three, four, six):
self.dice[0] = one
self.dice[2] = three
self.dice[4] = four
self.dice[5] = six
def W(self):
one = self.dice[2]
three = self.dice[5]
four = self.dice[0]
six = self.dice[3]
InsWE(one, three, four, six)
def E(self):
one = self.dice[3]
three = self.dice[0]
four = self.dice[5]
six = self.dice[2]
InsWE(one, three, four, six)
di = Dice(a)
for i in range(len(O)):
if O[i] == 'S':
di.S()
elif O[i] == 'N':
di.N()
elif O[i] == 'E':
di.E()
elif O[i] == 'W':
di.W()
print(di.dice[0])
|
s649259932 | p02383 | u801346721 | 1479113553 | Python | Python3 | py | Runtime Error | 0 | 0 | 1067 | d = list(map(int, input().split()))
O = input()
class Dice():
def __init__(self, d):
self.dice = d
def S(self):
one = self.dice[4]
two = self.dice[0]
five = self.dice[5]
six = self.dice[1]
InsSN(one, two, five, six)
def InsSN(self, one, two, five, six):
self.dice[0] = one
self.dice[1] = two
self.dice[4] = five
self.dice[5] = six
def N(self):
one = self.dice[1]
two = self.dice[5]
five = self.dice[0]
six = self.dice[4]
InsSN(one, two, five, six)
def InsWE(self, one, three, four, six):
self.dice[0] = one
self.dice[2] = three
self.dice[4] = four
self.dice[5] = six
def W(self):
one = self.dice[2]
three = self.dice[5]
four = self.dice[0]
six = self.dice[3]
InsWE(one, three, four, six)
def E(self):
one = self.dice[3]
three = self.dice[0]
four = self.dice[5]
six = self.dice[2]
InsWE(one, three, four, six)
d = Dice(d)
for i in range(len(O)):
if O[i] == 'S':
d.S()
elif O[i] == 'N':
d.N()
elif O[i] == 'E':
d.E()
elif O[i] == 'W':
d.W()
print(d.dice[0])
|
s582475067 | p02383 | u494314211 | 1481449500 | Python | Python3 | py | Runtime Error | 0 | 0 | 408 | d=list(map(int,input().split()))
c=list(input())
class dice(object):
def __init__(self, d):
self.d = d
def roll(self,com):
a1,a2,a3,a4,a5,a6=self.d
if com=="E":
self.d = [a4,a2,a1,a6,a5,a3]
elif com=="W":
self.d = [a3,a2,a6,a1,a5,a4]
elif com=="S":
self.d = [a5,a1,a3,a4,a6,a2]
elif com=="N":
self.d = [a2,a6,a3,a4,a1,a5]
dice1=dice(d)
for com in c:
roll(com)
print(dice1.d[0]) |
s515806848 | p02383 | u918276501 | 1484496752 | Python | Python3 | py | Runtime Error | 0 | 0 | 512 | class Dice:
def __init__(self, f):
self.f = f
# f = face := (top, sud, est, west, nord, botm)
dict = {'S' : (4, 0, 2, 3, 5, 1), \
'E' : (3, 1, 0, 5, 4, 2), \
'W' : (3, 1, 2, 3, 4, 5), \
'N' : (1, 5, 2, 3, 0, 4) }
def turn(self, c):
# c = command := 'NSEWs'
for i in range(len(c)):
f = [f[j] for j in dict[c[i]]]
face = list(map(int, input().strip().split()))
Dice(face).turn(input())
print(face[0]) |
s476771077 | p02383 | u513411598 | 1485104622 | Python | Python3 | py | Runtime Error | 20 | 7584 | 2372 | 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[__top] = dice_before[Dice.__front]
self.__dice[__front] = dice_before[Dice.__bottom]
self.__dice[__right] = dice_before[Dice.__right]
self.__dice[__left] = dice_before[Dice.__left]
self.__dice[__back] == dice_before[Dice.__top]
self.__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()) |
s393993789 | p02383 | u519227872 | 1486394331 | Python | Python3 | py | Runtime Error | 0 | 0 | 1515 | class Dice:
def __init__(self,l1,l2,l3,l4,l5,l6):
self.l1 = l1
self.l2 = l2
self.l3 = l3
self.l4 = l4
self.l5 = l5
self.l6 = l6
self.top = 1
self.front = 2
self.right = 3
def get_up_front(self):
return eval("("+"self." + 'l' + str(self.top)+","+"self." + 'l' + str(self.front)+")")
def get_right(self):
return eval("self." + 'l' + str(self.right))
def rot(self):
self.front,self.right = self.right,7-self.front
def move(self, order):
if order == 'S':
pretop = self.top
self.top = 7 - self.front
self.front = pretop
elif order == 'E':
pretop = self.top
self.top = 7 - self.right
self.right = pretop
elif order == 'N':
pretop = self.top
self.top = self.front
self.front = 7 - pretop
elif order == 'W':
pretop = self.top
self.top = self.right
self.right = 7 - pretop
l = list(map(int,input().split()))
q = int(input())
d = Dice(l[0],l[1],l[2],l[3],l[4],l[5])
for i in range(q):
up,front = list(map(int,input().split()))
while (up,front) != d.get_up_front():
for j in range(4):
d.move('S')
if up == d.get_up_front()[0]:
break
for k in range(4):
d.rot()
if front == d.get_up_front()[1]:
break
print (d.get_right()) |
s572016430 | p02383 | u144068724 | 1487044619 | Python | Python3 | py | Runtime Error | 0 | 0 | 357 | class Dice:
u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in range(len(data)):
if roll[i] == E:
tmp = e
e = u
u = w
w = b
b = tmp
elif roll[i] == S:
tmp = s
s = u
u = n
n = b
b = tmp
elif roll[i] == W:
tmp = w
w = u
u = e
e = b
b = tmp
elif roll[i] == N:
tmp = n
n = u
u = s
s = b
b = tmp
print(u) |
s660417806 | p02383 | u144068724 | 1487044690 | Python | Python3 | py | Runtime Error | 0 | 0 | 357 | class Dice:
u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in range(len(roll)):
if roll[i] == E:
tmp = e
e = u
u = w
w = b
b = tmp
elif roll[i] == S:
tmp = s
s = u
u = n
n = b
b = tmp
elif roll[i] == W:
tmp = w
w = u
u = e
e = b
b = tmp
elif roll[i] == N:
tmp = n
n = u
u = s
s = b
b = tmp
print(u) |
s857816515 | p02383 | u144068724 | 1487044707 | Python | Python3 | py | Runtime Error | 0 | 0 | 357 | class Dice:
u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in range(len(roll)):
if roll[i] == E:
tmp = e
e = u
u = w
w = b
b = tmp
elif roll[i] == S:
tmp = s
s = u
u = n
n = b
b = tmp
elif roll[i] == W:
tmp = w
w = u
u = e
e = b
b = tmp
elif roll[i] == N:
tmp = n
n = u
u = s
s = b
b = tmp
print(u) |
s755267896 | p02383 | u144068724 | 1487044729 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | class Dice:
u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in roll:
if roll[i] == E:
tmp = e
e = u
u = w
w = b
b = tmp
elif roll[i] == S:
tmp = s
s = u
u = n
n = b
b = tmp
elif roll[i] == W:
tmp = w
w = u
u = e
e = b
b = tmp
elif roll[i] == N:
tmp = n
n = u
u = s
s = b
b = tmp
print(u) |
s746999334 | p02383 | u144068724 | 1487044770 | Python | Python3 | py | Runtime Error | 0 | 0 | 321 | class Dice:
u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in roll:
if i == E:
tmp = e
e = u
u = w
w = b
b = tmp
elif i == S:
tmp = s
s = u
u = n
n = b
b = tmp
elif i == W:
tmp = w
w = u
u = e
e = b
b = tmp
elif i == N:
tmp = n
n = u
u = s
s = b
b = tmp
print(u) |
s683063633 | p02383 | u042885182 | 1493915640 | Python | Python3 | py | Runtime Error | 0 | 0 | 3523 | # 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)
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()
|
s646258600 | p02383 | u042885182 | 1493915999 | Python | Python3 | py | Runtime Error | 0 | 0 | 3543 | # 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()
|
s315293067 | p02383 | u042885182 | 1493916043 | Python | Python3 | py | Runtime Error | 0 | 0 | 3545 | # 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()
|
s270939336 | p02383 | u042885182 | 1493916066 | Python | Python3 | py | Runtime Error | 0 | 0 | 3546 | # 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()
|
s827781440 | p02383 | u042885182 | 1493916091 | Python | Python3 | py | Runtime Error | 0 | 0 | 3548 | # 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()
|
s030248222 | p02383 | u042885182 | 1493916142 | Python | Python3 | py | Runtime Error | 0 | 0 | 3554 | # 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()
|
s756861228 | p02383 | u042885182 | 1493916315 | Python | Python3 | py | Runtime Error | 0 | 0 | 3524 | # 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)
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()
|
s719087168 | p02383 | u042885182 | 1493916399 | Python | Python3 | py | Runtime Error | 0 | 0 | 3526 | # 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)
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()
|
s913810174 | p02383 | u042885182 | 1493916442 | Python | Python3 | py | Runtime Error | 0 | 0 | 3527 | # 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)
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()
|
s731355072 | p02383 | u042885182 | 1493916491 | Python | Python3 | py | Runtime Error | 0 | 0 | 3547 | # 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)
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)
pass
'''
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()
|
s453461214 | p02383 | u042885182 | 1493916728 | Python | Python3 | py | Runtime Error | 0 | 0 | 3644 | # coding: utf-8
# Here your code !
import sys
import collections
import math
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)
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):
def testEqual(self, func, tuples, eff_digit = matn.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)
pass
'''
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()
|
s812969896 | p02383 | u042885182 | 1493916751 | Python | Python3 | py | Runtime Error | 0 | 0 | 3644 | # coding: utf-8
# Here your code !
import sys
import collections
import math
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)
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):
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)
pass
'''
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()
|
s279806567 | p02383 | u042885182 | 1493926096 | Python | Python3 | py | Runtime Error | 0 | 0 | 4308 | # 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()
top_face_after_rolling_dice()
|
s704196371 | p02383 | u042885182 | 1493926140 | Python | Python3 | py | Runtime Error | 0 | 0 | 4314 | # 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()
top_face_after_rolling_dice()
|
s636825971 | p02383 | u042885182 | 1493926193 | Python | Python3 | py | Runtime Error | 0 | 0 | 4315 | # 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()
top_face_after_rolling_dice()
|
s997451496 | p02383 | u042885182 | 1493926225 | Python | Python3 | py | Runtime Error | 0 | 0 | 4321 | # 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()
top_face_after_rolling_dice()
|
s161263732 | p02383 | u042885182 | 1493926257 | Python | Python3 | py | Runtime Error | 0 | 0 | 4321 | # 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()
top_face_after_rolling_dice()
|
s246425843 | p02383 | u042885182 | 1493926308 | Python | Python3 | py | Runtime Error | 0 | 0 | 4321 | # 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()
top_face_after_rolling_dice()
|
s847298560 | p02383 | u042885182 | 1493926340 | Python | Python3 | py | Runtime Error | 0 | 0 | 4314 | # 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()
top_face_after_rolling_dice()
|
s599636435 | p02383 | u042885182 | 1493926429 | Python | Python3 | py | Runtime Error | 0 | 0 | 4320 | # 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()
top_face_after_rolling_dice()
|
s601725561 | p02383 | u042885182 | 1493926491 | Python | Python3 | py | Runtime Error | 0 | 0 | 4330 | # 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()
|
s608179599 | p02383 | u042885182 | 1493926519 | Python | Python3 | py | Runtime Error | 0 | 0 | 4333 | # 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 -1#__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()
|
s664869121 | p02383 | u042885182 | 1493926698 | Python | Python3 | py | Runtime Error | 0 | 0 | 4336 | # 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()
|
s737997853 | p02383 | u042885182 | 1493926745 | Python | Python3 | py | Runtime Error | 0 | 0 | 4349 | # 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()
|
s218817228 | p02383 | u042885182 | 1493926788 | Python | Python3 | py | Runtime Error | 0 | 0 | 4348 | # 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()
|
s309951730 | p02383 | u042885182 | 1493926817 | Python | Python3 | py | Runtime Error | 0 | 0 | 4348 | # coding: utf-8
# Here your code !
import numpy
from sys import exit
from collections import Iterable
from unittest import TestCase
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()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.