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
s996862213
p02383
u042885182
1493926876
Python
Python3
py
Runtime Error
0
0
12
import numpy
s079062111
p02383
u440180827
1496473104
Python
Python
py
Runtime Error
0
0
308
u, s, e, w, n, d = list(map(int, input().split())) insts = input() for inst in insts: if inst == 'N': u, s, n, d = s, d, u, n elif inst == 'E': u, e, w, d = w, u, d, e elif inst == 'S': u, s, n, d = n, u, d, s elif inst == 'W': u, e, w, d = e, d, u, w print(u)
s494583682
p02383
u659034691
1502759343
Python
Python3
py
Runtime Error
0
0
523
#dice D=[int(i) for i in input().split()] Os=input() for i in range(len(Os)): if Os[i]=="N": t=D[0] D[0]=D[1] D[1]=D[5] D[5]=D[4] D[4]=t elif Os[i]=="S": t=D[0] D[0]=D[4] D[4]=D[5] D[5]=D[1] D[1]=t elif Os[i]=="E": t=D[0] D[0]=D[3] D[3]=D[5] D[5]=D[2] D[2]=t elif Os[i]=="W": t=D[0] D[0]=D[2] D[2]=D[5] D[5]=D[3] D[3]=t print(D[0])
s294647842
p02383
u954858867
1504168264
Python
Python
py
Runtime Error
0
0
825
class Dice: current = 1 num = {} map = { 1:{'N':2, 'S':5, 'E':4, 'W':3}, 2:{'N':6, 'S':1, 'E':4, 'W':3}, 3:{'N':6, 'S':1, 'E':2, 'W':5}, 4:{'N':6, 'S':1, 'E':5, 'W':2}, 5:{'N':6, 'S':1, 'E':4, 'W':3}, 6:{'N':5, 'S':2, 'E':4, 'W':3}, } def __init__(self, num): for i, v in enumerate(num): self.num[i+1] = v def move(self, direct): self.current = self.map[self.current][direct] return self.map[self.current][direct] def getNum(self): return self.num[self.current] def move(direction): num = map(int, raw_input().split()) a = Dice(num) for d in direction: a.move(d) return a.getNum() if __name__ == '__main__': assert move('SE') == 8, '8' assert move('EESWN') == 32, '32'
s559311361
p02383
u954858867
1504168307
Python
Python
py
Runtime Error
0
0
825
class Dice: current = 1 num = {} map = { 1:{'N':2, 'S':5, 'E':4, 'W':3}, 2:{'N':6, 'S':1, 'E':4, 'W':3}, 3:{'N':6, 'S':1, 'E':2, 'W':5}, 4:{'N':6, 'S':1, 'E':5, 'W':2}, 5:{'N':6, 'S':1, 'E':4, 'W':3}, 6:{'N':5, 'S':2, 'E':4, 'W':3}, } def __init__(self, num): for i, v in enumerate(num): self.num[i+1] = v def move(self, direct): self.current = self.map[self.current][direct] return self.map[self.current][direct] def getNum(self): return self.num[self.current] def move(direction): num = map(int, raw_input().split()) a = Dice(num) for d in direction: a.move(d) return a.getNum() if __name__ == '__main__': assert move('SE') == 8, '8' assert move('EESWN') == 32, '32'
s040068443
p02383
u748921161
1507976440
Python
Python
py
Runtime Error
0
0
1088
#N E S W def move_func(dice_list, dir): new_dice = [] if dir=="N": new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[0]) new_dice.append(dice_list[4]) elif dir=="E": new_dice.append(dice_list[3]) new_dice.append(dice_list[1]) new_dice.append(dice_list[0]) new_dice.append(dice_list[5]) new_dice.append(dice_list[4]) new_dice.append(dice_list[2]) elif dir=="S": new_dice.append(dice_list[4]) new_dice.append(dice_list[0]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[5]) new_dice.append(dice_list[1]) elif dir=="W": new_dice.append(dice_list[2]) new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[3]) new_dice.append(dice_list[4]) new_dice.append(dice_list[0]) return new_dice try: while True: dice_list = input().split(" ") move_cmd = input() for cmd in move_cmd: dice_list = move_func(dice_list, cmd) print(dice_list[0]) except EOFError: pass
s979075731
p02383
u748921161
1507976465
Python
Python
py
Runtime Error
0
0
1079
def move_func(dice_list, dir): new_dice = [] if dir=="N": new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[0]) new_dice.append(dice_list[4]) elif dir=="E": new_dice.append(dice_list[3]) new_dice.append(dice_list[1]) new_dice.append(dice_list[0]) new_dice.append(dice_list[5]) new_dice.append(dice_list[4]) new_dice.append(dice_list[2]) elif dir=="S": new_dice.append(dice_list[4]) new_dice.append(dice_list[0]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[5]) new_dice.append(dice_list[1]) elif dir=="W": new_dice.append(dice_list[2]) new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[3]) new_dice.append(dice_list[4]) new_dice.append(dice_list[0]) return new_dice try: while True: dice_list = input().split(" ") move_cmd = input() for cmd in move_cmd: dice_list = move_func(dice_list, cmd) print(dice_list[0]) except EOFError: pass
s537040723
p02383
u518939641
1510580654
Python
Python3
py
Runtime Error
0
0
721
class Dice: def __init__(self): self.dice=[1,2,3,4,5,6] # up,front,right,left,back,front def set(self,l): self.dice=l def roll(self, s): import copy mat=((1,4,3,2),(5,0,1,1),(2,2,0,5),(3,3,5,0),(0,5,4,4),(4,1,2,3)) l=copy.deepcopy(self.dice) if s == 'N': c = 0 if s == 'S': c = 1 if s == 'E': c = 2 if s == 'W': c = 3 for i in range(6): print('i=%d, c=%d, mat[i][c]=%d, %d->%d'%(i,c,mat[i][c],self.dice[i],l[mat[i][c]])) self.dice[i]=l[mat[i][c]] def get(self): return self.dice d=Dice() d.set(list(map(int,input().split))) s=input() for i in range(len(s)): d.roll(s[i]) print(d.get()[0])
s604320794
p02383
u379645513
1513223297
Python
Python
py
Runtime Error
0
0
1080
class dice{ public: explicit dice(int in[6]){ for(int i=0;i<6;i++){ v[i]=in[i]; } } void mov(const char c){ int buf; switch(c){ case 'N':{ buf = v[0]; v[0] = v[1]; v[1] = v[5]; v[5] = v[4]; v[4] = buf; break; } case 'E':{ buf = v[0]; v[0] = v[3]; v[3] = v[5]; v[5] = v[2]; v[2] = buf; break; } case 'W':{ buf = v[0]; v[0] = v[2]; v[2] = v[5]; v[5] = v[3]; v[3] = buf; break; } case 'S':{ buf = v[0]; v[0] = v[4]; v[4] = v[5]; v[5] = v[1]; v[1] = buf; break; } } } int operator[](size_t i){return v[i];} private: int v[6]; };
s706809488
p02383
u379645513
1513223302
Python
Python3
py
Runtime Error
0
0
1080
class dice{ public: explicit dice(int in[6]){ for(int i=0;i<6;i++){ v[i]=in[i]; } } void mov(const char c){ int buf; switch(c){ case 'N':{ buf = v[0]; v[0] = v[1]; v[1] = v[5]; v[5] = v[4]; v[4] = buf; break; } case 'E':{ buf = v[0]; v[0] = v[3]; v[3] = v[5]; v[5] = v[2]; v[2] = buf; break; } case 'W':{ buf = v[0]; v[0] = v[2]; v[2] = v[5]; v[5] = v[3]; v[3] = buf; break; } case 'S':{ buf = v[0]; v[0] = v[4]; v[4] = v[5]; v[5] = v[1]; v[1] = buf; break; } } } int operator[](size_t i){return v[i];} private: int v[6]; };
s920852481
p02383
u585035894
1514479067
Python
Python3
py
Runtime Error
0
0
1411
import random class Dice(): def __init__(self, *n): self.rolls = n def spin(self, order): if order == "N": self.rolls = [ self.rolls[1], self.rolls[5], self.rolls[2], self.rolls[3], self.rolls[0], self.rolls[4] ] if order == "E": self.rolls = [ self.rolls[3], self.rolls[1], self.rolls[0], self.rolls[5], self.rolls[4], self.rolls[2] ] if order == "S": self.rolls = [ self.rolls[4], self.rolls[0], self.rolls[2], self.rolls[3], self.rolls[5], self.rolls[1] ] if order == "W": self.rolls = [ self.rolls[2], self.rolls[1], self.rolls[5], self.rolls[0], self.rolls[4], self.rolls[3] ] return self.rolls[0] d = Dice(*[int(i) for i in input().split()]) directions = ['N','E','S','W'] for _ in range(int(input())): a,b = [int(i) for i in input().split()] while a != d.rolls[0] or d.rolls[1] != b: d.spin(directions[random.randint(0,3)]) print(d.rolls[2])
s604986331
p02383
u017523606
1516528456
Python
Python3
py
Runtime Error
0
0
623
dice = input().split() direction = list(input()) dice2 = [] for i in range(len(direction)): dice2 = dice print(dice2) if direction[i] == 'E': dice = [dice2[3],dice2[1],dice2[0],dice2[5],dice2[4],dice2[2]] print(dice) elif direction[i] == 'N': dice = [dice2[1],dice2[5],dice2[2],dice2[3],dice2[0],dice2[4]] print(dice) elif direction[i] == 'S': dice = [dice2[4],dice2[0],dice2[2],dice2[3],dice2[5],dice2[1]] print(dice) else: dice = [dice2[2],dice2[1],dice2[5],dice2[0],dice2[4],dice2[3]] print(dice) print('{0}'.format(int(dice[0)]))
s983234188
p02383
u267728784
1516758801
Python
Python3
py
Runtime Error
0
0
499
l=map(int,raw_input().split()) n=raw_input() ans=chk=0 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 for i in n: l=rolling(i,l) print l[0]
s174631924
p02383
u294922877
1518757687
Python
Python3
py
Runtime Error
30
5996
1023
from collections import deque class Dice: def __init__(self, top, down, right, left, up, bottom): self.top = top self.bottom = bottom self.up = up self.down = down self.left = left self.right = right def roll(self, command): for c in list(command): if c == 'N': self.up, self.top, self.down, self.bottom = self.top, self.down, self.bottom, self.up elif c == 'S': self.up, self.top, self.down, self.bottom = self.bottom, self.up, self.top, self.down elif c == 'E': self.left, self.top, self.right, self.bottom = self.bottom, self.left, self.top, self.right elif c == 'W': self.left, self,top, self.right, self.bottom = self.top, self.right, self.bottom, self.left def pip(self): return self.top if __name__ == '__main__': seq = list(map(int, input().split())) dice = Dice(*seq) dice.roll(input()) print(dice.pip())
s892758239
p02383
u328199937
1524315434
Python
Python3
py
Runtime Error
0
0
1113
ef north(list): List = [] List.append(list[1]) List.append(list[5]) List.append(list[2]) List.append(list[3]) List.append(list[0]) List.append(list[4]) return List def west(list): List = [] List.append(list[2]) List.append(list[1]) List.append(list[5]) List.append(list[0]) List.append(list[4]) List.append(list[3]) return List def south(list): List = [] List.append(list[4]) List.append(list[0]) List.append(list[2]) List.append(list[3]) List.append(list[5]) List.append(list[1]) return List def east(list): List = [] List.append(list[3]) List.append(list[1]) List.append(list[0]) List.append(list[5]) List.append(list[4]) List.append(list[2]) return List dice = list(map(int, input().split())) x = str(input()) y = list(x) for i in range(len(x)): if y[i] == 'N': dice[0:5] = north(dice) elif y[i] == 'W': dice[0:5] = west(dice) elif y[i] == 'S': dice[0:5] = south(dice) elif y[i] == 'E': dice[0:5] = east(dice) print(dice[0])
s311376493
p02383
u327546577
1528148254
Python
Python3
py
Runtime Error
0
0
1171
class Dice(): def __init__(self, numbers): self.top = numbers[0] self.s = numbers[1] self.e = numbers[2] self.w = numbers[3] self.n = numbers[4] self.bot = numbers[5] def rot(self, dir): top, s, e, w, n, bot = (self.top, self.s, self.e, self.w, self.b, self.bot) if dir == 'N': self.top = s self.s = bot self.e = e self.w = w self.n = top self.bot = n elif dir == 'S': self.top = n self.s = top self.e = e self.w = w self.n = bot self.bot = s elif dir == 'E': self.top = w self.s = s self.e = top self.w = bot self.n = n self.bot = e elif dir == 'W': self.top = e self.s = s self.e = bot self.w = top self.n = n self.bot = w def getTop(self): return self.top li = map(int, input().split()) D = Dice(li) command = input() for dir in command: D.rot(dir) print(D.getTop())
s601938599
p02383
u327546577
1528148272
Python
Python3
py
Runtime Error
0
0
1177
class Dice(): def __init__(self, numbers): self.top = numbers[0] self.s = numbers[1] self.e = numbers[2] self.w = numbers[3] self.n = numbers[4] self.bot = numbers[5] def rot(self, dir): top, s, e, w, n, bot = (self.top, self.s, self.e, self.w, self.b, self.bot) if dir == 'N': self.top = s self.s = bot self.e = e self.w = w self.n = top self.bot = n elif dir == 'S': self.top = n self.s = top self.e = e self.w = w self.n = bot self.bot = s elif dir == 'E': self.top = w self.s = s self.e = top self.w = bot self.n = n self.bot = e elif dir == 'W': self.top = e self.s = s self.e = bot self.w = top self.n = n self.bot = w def getTop(self): return self.top li = list(map(int, input().split())) D = Dice(li) command = input() for dir in command: D.rot(dir) print(D.getTop())
s134058467
p02383
u940150266
1528937016
Python
Python3
py
Runtime Error
0
0
204
num = (int, input().split()) dice = {'N':(2, 6, 3, 4, 1, 5),'E':(4, 2, 1, 6, 5, 3),'W':(3, 2, 6, 1, 5, 4),'S':(5, 1, 3, 4, 6, 2)} for alf in input(): num = [num[i]for i in dice[alf-1]] print(num[0])
s369609605
p02384
u869301406
1530950416
Python
Python3
py
Runtime Error
0
0
1300
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(self, x, y): temp = y.pop(0) y.append(temp) x[0] = y[0] x[2] = y[2] def __move_prev(self, x, y): temp = y.pop(3) y.insert(0, temp) x[0] = y[0] x[2] = y[2] def execute(self, c): for i in self.c: self.__move(i, self.rows, self.cols) def __move(self, com, x, y): if com == "N": self.__move_prev(y, x) elif com == "S": self.__move_next(y, x) elif com == "E": self.__move_prev(x, y) elif com == "W": self.__move_next(x, y) def print_top(self): print(self.rows[0]) def execute2(self, a, b): while self.rows[0] == b: self.__move_next(self.rows, self.cols) while self.rows[0] == a and self.rows[1] == b: self.__move_next(self.cols, self.rows) def print_right_side(self): print(self.cols[4]) d = map(int, input().split(" ")) c = input() dice = Dice2(d) for i in range(c): a, b = map(int, input().split(" ")) dice.execute2(a,b) dice.print_right_side()
s448065322
p02384
u874395007
1546332921
Python
Python3
py
Runtime Error
0
0
1895
from typing import List class Dice: sur = [i for i in range(6)] def __init__(self, s: List[int]): self.s = s # surfaceリスト # indexが面の番号。リストの値は、それに接する面の番号。 self.sur[0] = [1, 2, 4, 3] self.sur[1] = [0, 3, 5, 2] self.sur[2] = [1, 5, 4, 0] self.sur[3] = [1, 0, 4, 5] self.sur[4] = [0, 2, 5, 3] self.sur[5] = [1, 3, 4, 2] def get_right_face_num(self, upper_num: int, front_num: int) -> int: for i, value in enumerate(self.sur[upper_num]): if value == front_num: return self.sur[upper_num][(i + 1) % 4] else: raise ValueError('get_right_faceの来てはいけない箇所') def get_value(self, face_num) -> int: return self.s[face_num] def get_face_num(self, value) -> int: for i in range(len(self.s)): if value == self.s[i]: return i else: raise ValueError('get_sur_indexの来てはいけない箇所') # 提出用 data = [int(i) for i in input().split()] N = int(input()) dice = Dice(data) for _i in range(N): upper_value, front_value = map(int, input().split()) upper_num = dice.get_face_num(upper_value) front_num = dice.get_face_num(front_value) ans_num = dice.get_right_face_num(upper_num, front_num) print(dice.get_value(ans_num)) # 動作確認用 with open('input_itp1_11_a_1.txt', mode='r', encoding='utf8') as fin: data = [int(i) for i in next(fin).split()] N = int(next(fin)) dice = Dice(data) for _i in range(N): upper_value, front_value = map(int, next(fin).split()) upper_num = dice.get_face_num(upper_value) front_num = dice.get_face_num(front_value) ans_num = dice.get_right_face_num(upper_num, front_num) print(dice.get_value(ans_num))
s124314372
p02384
u482227082
1558925170
Python
Python3
py
Runtime Error
0
0
1235
import random 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()) cube = Cube(u, s, e, w, n, d) q = int(input()) for i in range(q): upper, front = map(int, input().split()) while True: cube.rotate(random.choice("NWES")) if upper == cube.u and front == cube.s: print(cube.e) break if __name__ == '__main__': main(
s833420454
p02384
u218784088
1559540883
Python
Python3
py
Runtime Error
0
0
2187
#include<iostream> using namespace std; int main(){ int n, a, b; int c[6]={}; for (int i=0; i<6; i++) { cin >> c[i]; } cin >> n; for (int i=0; i<n; i++) { cin >> a >> b; if (a==c[0]) { if (b==c[1]) { cout << c[2] << endl; } else if (b==c[2]) { cout << c[4] << endl; } else if (b==c[3]) { cout << c[1] << endl; } else if (b==c[4]) { cout << c[3] << endl; } } else if (a==c[1]) { if (b==c[0]) { cout << c[3] << endl; } else if (b==c[2]) { cout << c[0] << endl; } else if (b==c[3]) { cout << c[5] << endl; } else if (b==c[5]) { cout << c[2] << endl; } } else if (a==c[2]) { if (b==c[0]) { cout << c[1] << endl; } else if (b==c[1]) { cout << c[5] << endl; } else if (b==c[4]) { cout << c[0] << endl; } else if (b==c[5]) { cout << c[4] << endl; } } else if (a==c[3]) { if (b==c[0]) { cout << c[4] << endl; } else if (b==c[1]) { cout << c[0] << endl; } else if (b==c[4]) { cout << c[5] << endl; } else if (b==c[5]) { cout << c[1] << endl; } } else if (a==c[4]) { if (b==c[0]) { cout << c[2] << endl; } else if (b==c[2]) { cout << c[5] << endl; } else if (b==c[3]) { cout << c[0] << endl; } else if (b==c[5]) { cout << c[3] << endl; } } else if (a==c[5]) { if (b==c[1]) { cout << c[3] << endl; } else if (b==c[2]) { cout << c[1] << endl; } else if (b==c[3]) { cout << c[4] << endl; } else if (b==c[4]) { cout << c[2] << endl; } } } return 0; }
s139376594
p02384
u567380442
1421233786
Python
Python3
py
Runtime Error
0
0
612
mask = [range(6), (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)] mask += [mask[1][i] for i in mask[1]] TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM = mask[0] def set_top(dice, top): return [dice[i] for i in mask[top]] def set_front(dice, front): twist = (0, 3, 1, 4, 2, 5) while dice[FRONT] != front: dice = [dice[i] for i in twist] return dice label = input().split() q = int(input()) for _ in range(q): top, front = map(label.index, input().split()) dice = set_top(mask[0], top) dice = set_front(dice, front) print(label[dice[RIGHT]])
s846383401
p02384
u297342993
1423729841
Python
Python3
py
Runtime Error
0
0
274
from Dice import Dice dice = Dice(input().split()) count = int(input()) result = [] for i in range(count): (top, front) = [i for i in input().split()] dice.moveTopTo(top) dice.moveFrontTo(front) result.append(dice.getRight()) for s in result: print(s)
s141041371
p02384
u571345655
1435308627
Python
Python
py
Runtime Error
10
4364
2030
# coding=utf-8 class Dice(object): def __init__(self, label): self.label = label def _rotateS(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s5, s1, s3, s4, s6, s2] def _rotateN(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s2, s6, s3, s4, s1, s5] def _rotateE(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s4, s2, s1, s6, s5, s3] def _rotateW(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s3, s2, s6, s1, s5, s4] def rotate(self, r): if r == 'S': self._rotateS() elif r == 'N': self._rotateN() elif r == 'E': self._rotateE() elif r == 'W': self._rotateW() else: print 'Cannot rotate into ' + r + 'direction.' def _spinPos(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s1, s4, s2, s5, s4, s6] def _spinNeg(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s1, s3, s5, s2, s4, s6] def getTopLabel(self): return self.label[0] def match(self, top, front): iTop = self.label.index(top) + 1 if iTop == 1: pass elif iTop == 2: self._rotateN() elif iTop == 3: self._rotateW() elif iTop == 4: self._rotateE() elif iTop == 5: self._rotateS() else: self._rotateS() self._rotateS() iFront = self.label.index(front) + 1 if iFront == 2: pass elif iFront == 3: self._spinNeg() elif iFront == 4: self._spinPos() elif iFront == 5: self._spinPos() self._spinPos() if __name__ == '__main__': d = Dice(map(int, raw_input().split())) n = input() for _ in xrange(n): top, front = map(int, raw_input().split()) d.match(top, front) print d.label[2]
s327425384
p02384
u072053884
1447301062
Python
Python3
py
Runtime Error
20
7836
2594
class Dice: def __init__(self, face_vals): self.faces = dict(zip(['top', 'front', 'right', 'left', 'back', 'bottom'], face_vals.split())) def roll(self, direction): if direction == 'N': self.faces['top'], self.faces['front'], self.faces['bottom'], \ self.faces['back'] = self.faces['front'], self.faces['bottom'], \ self.faces['back'], self.faces['top'] elif direction == 'S': self.faces['top'], self.faces['front'], self.faces['bottom'], \ self.faces['back'] = self.faces['back'], self.faces['top'], \ self.faces['front'], self.faces['bottom'] elif direction == 'E': self.faces['top'], self.faces['right'], self.faces['bottom'], \ self.faces['left'] = self.faces['left'], self.faces['top'], \ self.faces['right'], self.faces['bottom'] else: self.faces['top'], self.faces['right'], self.faces['bottom'], \ self.faces['left'] = self.faces['right'], self.faces['bottom'], \ self.faces['left'], self.faces['top'] def _revolve(self, direction): if direction == 'R': self.faces['front'], self.faces['left'], self.faces['back'], \ self.faces['right'] = self.faces['right'], self.faces['front'], \ self.faces['left'], self.faces['back'] else: self.faces['front'], self.faces['left'], self.faces['back'], \ self.faces['right'] = self.faces['left'], self.faces['back'], \ self.faces['right'], self.faces['front'] def show_right_face(self, top, front): if front == self.faces['back']: if top == self.faces['top']: self._revolve('R') self._revolve('R') else: self.roll('S') self.roll('S') elif front == self.faces['right']: self._revolve('R') elif front == self.faces['left']: self._revolve('L') elif front == self.faces('bottom'): self.roll('N') if top == self.faces['bottom']: self.roll('E') self.roll('E') elif top == self.faces['right']: self.roll('W') elif top == self.faces['left']: self.roll('E') print(self.faces['right']) import sys face_vals = sys.stdin.readline() dice = Dice(face_vals) n = int(sys.stdin.readline()) for i in range(n): top, front = sys.stdin.readline().split() dice.show_right_face(top, front)
s020846342
p02384
u811841526
1449504302
Python
Python3
py
Runtime Error
0
0
2019
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 get_face(self, face): if face == 'top': return self.top elif face == 'south': return self.south elif face == 'east': return self.east elif face == 'west': return self.west elif face == 'north': return self.north elif face == 'bottom': return self.bottom def rotate(self, directions): for direction in directions: if direction == 'S': self.prev_top = self.top self.top = self.north self.north = self.bottom self.bottom = self.south self.south = self.prev_top elif direction == 'E': self.prev_top = self.top self.top = self.west self.west = self.bottom self.bottom = self.east self.east = self.prev_top elif direction == 'W': self.prev_top = self.top self.top = self.east self.east = self.bottom self.bottom = self.west self.west = self.prev_top elif direction == 'N': self.prev_top = self.top self.top = self.south self.south = self.bottom self.bottom = self.north self.north = self.prev_top dice = Dice(*map(int,input().split())) n = input() for _ in range(n): top, south = map(int, input().split()) # find top face for direction in 'NNNEEE': if dice.get_face('top') == top: break dice.rotate(direction) # find south face for direction in 'NES'*3: if dice.get_face('south') == south: break print(dice.get_face('east'))
s692974784
p02384
u811841526
1449504523
Python
Python3
py
Runtime Error
0
0
2076
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 get_face(self, face): if face == 'top': return self.top elif face == 'south': return self.south elif face == 'east': return self.east elif face == 'west': return self.west elif face == 'north': return self.north elif face == 'bottom': return self.bottom def rotate(self, directions): for direction in directions: if direction == 'S': self.prev_top = self.top self.top = self.north self.north = self.bottom self.bottom = self.south self.south = self.prev_top elif direction == 'E': self.prev_top = self.top self.top = self.west self.west = self.bottom self.bottom = self.east self.east = self.prev_top elif direction == 'W': self.prev_top = self.top self.top = self.east self.east = self.bottom self.bottom = self.west self.west = self.prev_top elif direction == 'N': self.prev_top = self.top self.top = self.south self.south = self.bottom self.bottom = self.north self.north = self.prev_top dice = Dice(*map(int,input().split())) n = input() for _ in range(n): top, south = map(int, input().split()) # find top face for direction in 'NNNEEE': if dice.get_face('top') == top: break dice.rotate(direction) # find south face for directions in ['NES']*3: if dice.get_face('south') == south: break for direction in directions: dice.rotate(direction) print(dice.get_face('east'))
s488048212
p02384
u580607517
1452520254
Python
Python
py
Runtime Error
0
0
1477
import copy class Dice(object): def __init__(self, List): self.face = List def n_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[1] List[1] = List[5] List[5] = List[4] List[4] = temp def s_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[4] List[4] = List[5] List[5] = List[1] List[1] = temp def e_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[3] List[3] = List[5] List[5] = List[2] List[2] = temp def w_spin(self, a_List): List = copy.copy(a_List) 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 c in command: # if c == "N": # dice.n_spin(dice.face) # elif c == "S": # dice.s_spin(dice.face) # elif c == "E": # dice.e_spin(dice.face) # elif c == "W": # dice.w_spin(dice.face) emer = copy.copy(dice.face) face_storage = [] q = input() for a in range(q): question = map(int, raw_input().split()) for a in range(24): face_storage.append(dice.n_spin(face_storage[a])) face_storage.append(dice.s_spin(face_storage[a])) face_storage.append(dice.w_spin(face_storage[a])) face_storage.append(dice.e_spin(face_storage[a])) for c in face_storage: if c[0] == question[0] and c[1] == question[1]: print c[2] break
s323207457
p02384
u580607517
1452520270
Python
Python
py
Runtime Error
0
0
1237
import copy class Dice(object): def __init__(self, List): self.face = List def n_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[1] List[1] = List[5] List[5] = List[4] List[4] = temp def s_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[4] List[4] = List[5] List[5] = List[1] List[1] = temp def e_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[3] List[3] = List[5] List[5] = List[2] List[2] = temp def w_spin(self, a_List): List = copy.copy(a_List) 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())) emer = copy.copy(dice.face) face_storage = [] q = input() for a in range(q): question = map(int, raw_input().split()) for a in range(24): face_storage.append(dice.n_spin(face_storage[a])) face_storage.append(dice.s_spin(face_storage[a])) face_storage.append(dice.w_spin(face_storage[a])) face_storage.append(dice.e_spin(face_storage[a])) for c in face_storage: if c[0] == question[0] and c[1] == question[1]: print c[2] break
s653962215
p02384
u580607517
1452520349
Python
Python
py
Runtime Error
0
0
1322
import copy class Dice(object): def __init__(self, List): self.face = List def n_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[1] List[1] = List[5] List[5] = List[4] List[4] = return List def s_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[4] List[4] = List[5] List[5] = List[1] List[1] = temp return List def e_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[3] List[3] = List[5] List[5] = List[2] List[2] = temp return List def w_spin(self, a_List): List = copy.copy(a_List) temp = List[0] List[0] = List[2] List[2] = List[5] List[5] = List[3] List[3] = temp return List dice = Dice(map(int, raw_input().split())) emer = copy.copy(dice.face) face_storage = [] face_storage.append(emer) q = input() for a in range(q): question = map(int, raw_input().split()) for a in range(24): face_storage.append(dice.n_spin(face_storage[a])) face_storage.append(dice.s_spin(face_storage[a])) face_storage.append(dice.w_spin(face_storage[a])) face_storage.append(dice.e_spin(face_storage[a])) for c in face_storage: if c[0] == question[0] and c[1] == question[1]: print c[2] break
s635124767
p02384
u998435601
1473940813
Python
Python3
py
Runtime Error
0
0
1292
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ???????????????????????° # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1), "R": (0, 1), "L": (1, 0)} def rotate(self, dir): def rot(k, r): # k?????????????????????????????????????????§?§???? # r?????????????????¢???????§???? t = self.axmap[r] self.axmap[k], self.axmap[r] = t, self.axmap[k] self.ax[t][1] = not self.ax[t][1] rot(*self.mm[dir]) def top(self): z = self.ax[self.axmap[2]] return self.dice[z[0]][z[1]] def right(self): y = self.ax[self.axmap[1]] return self.dice[y[0]][y[1]] def front(self): x = self.ax[self.axmap[0]] return self.dice[x[0]][x[1]] if __name__=="__main__": dice = Dice() labels = input().split() q = int(input()) for _ in range(q): a, b = input().split() p = labels.index(a) + 1 for _ in range(4): if p==dice.top(): break dice.rotate("N") for _ in range(4): if p==dice.top(): break dice.rotate("E") p = labels.index(b) + 1 for _ in range(4): if p==dice.front(): break; dice.rotate("R") print(labels(dice.right()-1))
s440669688
p02384
u998435601
1473943478
Python
Python3
py
Runtime Error
0
0
1257
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1), "R": (0, 1), "L": (1, 0)} def rotate(self, dir): def rot(k, r): t = self.axmap[r] self.axmap[k], self.axmap[r] = t, self.axmap[k] self.ax[t][1] = not self.ax[t][1] rot(*self.mm[dir]) def front(self): return self.value(0, True) def rear(self): return self.value(0, False) def right(self): return self.value(1, True) def left(self): return self.value(1, False) def top(self): return self.value(2, True) def bottom(self): return self.value(2, False) def value(self, ax, d): a = self.ax[self.axmap[ax]] return self.dice[a[0]][a[1] if d else not a[1]] if __name__=="__main__": dice = Dice() labels = raw_input().split() q = int(raw_input()) def tf(p, f, d): for _ in range(4): if p==f(): break dice.rotate(d) for _ in range(q): a, b = raw_input().split() p = labels.index(a) + 1 f = dice.top tf(p, f, "N") tf(p, f, "E") p = labels.index(b) + 1 f = dice.front tf(p, f, "R") print(labels[dice.right()-1])
s312616313
p02384
u831244171
1478322760
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])
s788227405
p02384
u546285759
1480844129
Python
Python3
py
Runtime Error
40
7752
363
dice = {v: k for k, v in enumerate(list(map(int, input().split())))} adjacent = {k: v for k, v in enumerate(sorted(dice.keys()))} q = int(input()) p = [(-1,2,4,1,3,-1),(3,-1,0,5,-1,2),(1,5,-1,-1,0,4),(4,0,-1,-1,5,1),(2,-1,5,0,-1,3),(-1,3,1,4,2,-1)] for _ in range(q): top, front = map(int, input().split()) x = dice[top] print(adjacent[p[x][front-1]])
s791172405
p02384
u546285759
1480844351
Python
Python3
py
Runtime Error
0
0
378
dice = {v: k for k, v in enumerate(list(map(int, input().split())))} adjacent = {k: v for k, v in enumerate(sorted(dice.keys()))} q = int(input()) p = [(-1,2,4,1,3,-1),(3,-1,0,5,-1,2),(1,5,-1,-1,0,4),(4,0,-1,-1,5,1),(2,-1,5,0,-1,3),(-1,3,1,4,2,-1)] for _ in range(q): top, front = map(int, input().split()) x = dice[top] y = dice[front-1] print(adjacent[p[x][y])
s365285359
p02384
u918276501
1484505423
Python
Python3
py
Runtime Error
0
0
365
f = input().split() input() while True: t, s = map(f.index, input().split()) if t in A and s in A: print(f[2]) if A.index(t) - A.index(s) in D else print(f[3]) if t in B and s in B: print(f[0]) if B.index(t) - B.index(s) in D else print(f[5]) if t in C and s in C: print(f[1]) if C.index(t) - C.index(s) in D else print(f[4])
s178199508
p02384
u918276501
1484505457
Python
Python3
py
Runtime Error
0
0
415
A,B,C = (0,1,5,4),(1,2,4,3),(2,0,3,5) D = (-1,3) f = input().split() input() while True: t, s = map(f.index, input().split()) if t in A and s in A: print(f[2]) if A.index(t) - A.index(s) in D else print(f[3]) if t in B and s in B: print(f[0]) if B.index(t) - B.index(s) in D else print(f[5]) if t in C and s in C: print(f[1]) if C.index(t) - C.index(s) in D else print(f[4])
s736738274
p02384
u918276501
1484508487
Python
Python3
py
Runtime Error
0
0
309
rot = ((1,2,4,3),(2,0,3,5),(0,1,5,4)) f = input().split() for i in range(int(input())): t, s = map(f.index, input().split()) for j in rot: if (t in j)*(s in j): continue d = rot.index(j) if (j.index(t) - j.index(s)) %4 == 1: d -= 5 print(f[abs(d)])
s173921004
p02384
u513411598
1485676499
Python
Python3
py
Runtime Error
20
7848
3155
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] def S(self): dice_before = self.__dice[:] self.__dice[Dice.__top] = dice_before[Dice.__back] self.__dice[Dice.__front] = dice_before[Dice.__top] self.__dice[Dice.__right] = dice_before[Dice.__right] self.__dice[Dice.__left] = dice_before[Dice.__left] self.__dice[Dice.__back] = dice_before[Dice.__bottom] self.__dice[Dice.__bottom] = dice_before[Dice.__front] def E(self): dice_before = self.__dice[:] self.__dice[Dice.__top] = dice_before[Dice.__left] self.__dice[Dice.__front] = dice_before[Dice.__front] self.__dice[Dice.__right] = dice_before[Dice.__top] self.__dice[Dice.__left] = dice_before[Dice.__bottom] self.__dice[Dice.__back] = dice_before[Dice.__back] self.__dice[Dice.__bottom] = dice_before[Dice.__right] def W(self): dice_before = self.__dice[:] self.__dice[Dice.__top] = dice_before[Dice.__right] self.__dice[Dice.__front] = dice_before[Dice.__front] self.__dice[Dice.__right] = dice_before[Dice.__bottom] self.__dice[Dice.__left] = dice_before[Dice.__top] self.__dice[Dice.__back] = dice_before[Dice.__back] self.__dice[Dice.__bottom] = dice_before[Dice.__left] def N(self): dice_before = self.__dice[:] self.__dice[Dice.__top] = dice_before[Dice.__front] self.__dice[Dice.__front] = dice_before[Dice.__bottom] self.__dice[Dice.__right] = dice_before[Dice.__right] self.__dice[Dice.__left] = dice_before[Dice.__left] self.__dice[Dice.__back] = dice_before[Dice.__top] self.__dice[Dice.__bottom] = dice_before[Dice.__back] def turn(self): dice_before = self.__dice[:] self.__dice[Dice.__top] = dice_before[Dice.__top] self.__dice[Dice.__front] = dice_before[Dice.__right] self.__dice[Dice.__right] = dice_before[Dice.__back] self.__dice[Dice.__left] = dice_before[Dice.__front] self.__dice[Dice.__back] = dice_before[Dice.__left] self.__dice[Dice.__bottom] = dice_before[Dice.__bottom] def top(self): return(self.__dice[Dice.__top]) def front(self): return(self.__dice[Dice.__front]) def right(self): return(self.__dice[Dice.__right]) def S(dice, top): for t in range(4): if dice.top() == top: return dice dice.S() def turn(dice, front): for t in range(4): if dice.front() == front: return dice dice.turn() a,b,c,d,e,f = input().split() dice = Dice(a,b,c,d,e,f) q = int(input()) for i in range(q): top,front = input().split() for t in range(2): dice = S(dice, top) if dice.top() == top: break else: dice.turn() for f in range(4): dice = turn(dice, front) if dice.front() == front: print(dice.right()) break
s405002704
p02384
u104171359
1487211787
Python
Python3
py
Runtime Error
0
0
2299
#!usr/bin/env python3 import sys class Die: def __init__(self, pips): self.pips = pips def move_die(self, direction): if direction == 'N': tmp = self.pips[0] self.pips[0] = self.pips[1] self.pips[1] = self.pips[5] self.pips[5] = self.pips[4] self.pips[4] = tmp del tmp elif direction == 'S': tmp = self.pips[0] self.pips[0] = self.pips[4] self.pips[4] = self.pips[5] self.pips[5] = self.pips[1] self.pips[1] = tmp del tmp elif direction == 'E': tmp = self.pips[0] self.pips[0] = self.pips[3] self.pips[3] = self.pips[5] self.pips[5] = self.pips[2] self.pips[2] = tmp del tmp elif direction == 'W': tmp = self.pips[0] self.pips[0] = self.pips[2] self.pips[2] = self.pips[5] self.pips[5] = self.pips[3] self.pips[3] = tmp del tmp def spin_die_clockwise(self): tmp = self.pips[1] self.pips[1] = self.pips[2] self.pips[2] = self.pips[4] self.pips[4] = self.pips[3] self.pips[3] = tmp del tmp def get_upside(self): return self.pips[0] def get_frontside(self): return self.pips[1] def get_rightside(self): return self.pips[2] def init_die(): pips = [int(pip) for pip in sys.stdin.readline().strip('\n').split()] die = Die(pips) return die def roll_die(die): directions = list(sys.stdin.readline().strip('\n')) for direction in directions: die.move_die(direction) return die def main(): die = init_die() q = int(sys.stdin.readline().strip('\n')) for question in range(q): q_pips = [int(pip) for pip in sys.stdin.readline().strip('\n').split()] if q_pips[0] == die.pips[0]: pass elif q_pips[0] == die.pips[1]: die.move_die('N') elif q_pips[0] == die.pips[2]: die.move_die('W') elif q_pips[0] == die.pips[3]: die.move_die('E') elif q_pips[0] == die.pips[4]: die.move_die('S') elif q_pips[0] == die.pips[5]:
s165909303
p02384
u104171359
1487309955
Python
Python3
py
Runtime Error
0
0
2361
#!usr/bin/env python3 import sys class Die: def __init__(self, pips): self.pips = pips def move_die(self, direction): if direction == 'N': tmp = self.pips[0] self.pips[0] = self.pips[1] self.pips[1] = self.pips[5] self.pips[5] = self.pips[4] self.pips[4] = tmp del tmp elif direction == 'S': tmp = self.pips[0] self.pips[0] = self.pips[4] self.pips[4] = self.pips[5] self.pips[5] = self.pips[1] self.pips[1] = tmp del tmp elif direction == 'E': tmp = self.pips[0] self.pips[0] = self.pips[3] self.pips[3] = self.pips[5] self.pips[5] = self.pips[2] self.pips[2] = tmp del tmp elif direction == 'W': tmp = self.pips[0] self.pips[0] = self.pips[2] self.pips[2] = self.pips[5] self.pips[5] = self.pips[3] self.pips[3] = tmp del tmp def spin_die_clockwise(self): tmp = self.pips[1] self.pips[1] = self.pips[2] self.pips[2] = self.pips[4] self.pips[4] = self.pips[3] self.pips[3] = tmp del tmp def init_die(): pips = [int(pip) for pip in sys.stdin.readline().strip('\n').split()] die = Die(pips) return die def roll_die(die): directions = list(sys.stdin.readline().strip('\n')) for direction in directions: die.move_die(direction) return die def question_rightside(die): q = int(sys.stdin.readline().strip('\n')) for question in range(q): q_pips = [int(pip) for pip in sys.stdin.readline().strip('\n').split()] if q_pips[0] == die.pips[1]: die.move_die('N') elif q_pips[0] == die.pips[2]: die.move_die('W') elif q_pips[0] == die.pips[3]: die.move_die('E') elif q_pips[0] == die.pips[4]: die.move_die('S') elif q_pips[0] == die.pips[5]: die.move_die('N') die.move_die('N') while die.get_frontside() != q_pips[1]: die.spin_die_clockwise() return die.get_rightside() def main(): die = init_die() print(question_rightside(die)) if __name__ == '__main__': main()
s700517143
p02384
u548155360
1487349473
Python
Python3
py
Runtime Error
30
7700
1043
class Dice(): def __init__(self, label): self.d = label def roll(self, drt): if drt == 'N': self.d[1], self.d[2], self.d[6], self.d[5] = self.d[2], self.d[6], self.d[5], self.d[1] elif drt == 'E': self.d[1], self.d[3], self.d[6], self.d[4] = self.d[4], self.d[1], self.d[3], self.d[6] elif drt == 'S': self.d[2], self.d[6], self.d[5], self.d[1] = self.d[1], self.d[2], self.d[6], self.d[5] elif drt == 'W': self.d[4], self.d[1], self.d[3], self.d[6] = self.d[1], self.d[3], self.d[6], self.d[4] def printl(self, lct): print(self.d[lct]) def rot(self, drc): self.roll('N') if drc == 'r': self.roll('E') elif drc == 'l': self.roll('W') self.roll('S') label = [0] label.extend(list(map(int, input().split()))) dice1 = Dice(label) q = int(input()) ST = 'NNNNEEE' SF = 'rrr' for i in range(q): s = list(map(int, input().split())) for j in range(7): if dice1.d[1] == s[0]: break dice1.roll(ST[j]) for k in range(3): if dice1.d[2] == s[1]: break dice1.rot(SF[j]) dice1.printl(3)
s516021491
p02384
u024715419
1488511045
Python
Python3
py
Runtime Error
0
0
938
class dice: def __init__(self, pip): self.pip = pip def move(self,dir): if str(dir) == "E": self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[3],self.pip[0],self.pip[5],self.pip[2] elif str(dir) == "W": self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[2],self.pip[5],self.pip[0],self.pip[3] elif str(dir) == "N": self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[1],self.pip[5],self.pip[0],self.pip[4] elif str(dir) == "S": self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[4],self.pip[0],self.pip[5],self.pip[1] d = dice(list(map(int,input().split()))) n = int(input()) for i in range(n): top, front = map(int,input().split()) for op in "EEENEEENEEESEEESEEENEEEN" d.move(op) if d.pip[0] == top and d.pip[1] == front: break print(d.pip[2])
s825325884
p02384
u756958775
1490540459
Python
Python3
py
Runtime Error
30
8044
617
import copy class Dice2: def __init__(self, nums): self.nums = nums self.dic = \ {(1,2):3, (1,3):5, (1,4):2, (1,5):4, (2,3):1, (2,4):6, (2,6):3, (3,5):1, (3,6):5, (4,5):6, (4,6):2, (5,6):4} def output_right(self, x): nums = self.nums y = copy.deepcopy(x) x.sort() key = tuple(x) if tuple(y)==key: return nums[self.dic[key]-1] else: return nums[6-self.dic[key]] dice = Dice2(list(map(int, input().split()))) q = int(input()) for i in range(q): print(dice.output_right(list(map(int, input().split()))))
s901104875
p02384
u782850499
1491669415
Python
Python3
py
Runtime Error
20
7480
803
class dice_2: def __init__(self,label): self.spots = label def result(self,top,front): if top == 1: self.order=[2,3,5,4,2] elif top == 2: self.order=[6,3,1,4,6] elif top == 3: self.order=[2,6,5,1,2] elif top == 4: self.order=[2,1,5,6,2] elif top == 5: self.order=[1,3,6,4,1] elif top == 6: self.order=[2,4,5,3,2] for i in range(4): if self.order[i] == front: self.right = self.order[i+1] def output(self): print(self.spots[self.right-1]) label = list(map(int,input().split())) dice = dice_2(label) for i in range(int(input())): top,front = map(int,(input().split())) dice.result(top,front) dice.output()
s473243282
p02384
u042885182
1493983682
Python
Python3
py
Runtime Error
0
0
8316
# coding: utf-8 # Here your code ! from sys import exit from collections import Iterable from unittest import TestCase import random 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 = ArbitraryValueCubicDice(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) # dice.throw() for operator in rollings: dice.roll(operator) print(dice.get_value(dice.TOP)) class ArbitraryValueCubicDice(): (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 = ( ( 0,-1, 0), ( 1, 0, 0), ( 0, 0, 1) ) # ROLL_y2x = ( ( 0, 1, 0), (-1, 0, 0), ( 0, 0, 1) ) # ROLL_y2z = ( ( 1, 0, 0), ( 0, 0,-1), ( 0, 1, 0) ) # ROLL_z2y = ( ( 1, 0, 0), ( 0, 0, 1), ( 0,-1, 0) ) # ROLL_z2x = ( ( 0, 0, 1), ( 0, 1, 0), (-1, 0, 0) ) # ROLL_x2z = ( ( 0, 0,-1), ( 0, 1, 0), ( 1, 0, 0) ) 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]] 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[self.stDIRECTION] = self.DIRECTION[dir_fi] def roll(self, operator) : #opetator: (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]))) vector = info[self.stDIRECTION] matrix = self.OPERATOR[operator] info[self.stDIRECTION] = tuple([sum( [matrix[row][col]*vector[col] for col in range(len(vector))] ) for row in range(len(matrix))]) def throw(self,roll_times = 20): operators = tuple(self.OPERATOR.keys()) for i in range(roll_times): self.roll(operators[random.randrange(len(operators))]) def re_put(self, top = None, bottom = None, east = None, west = None, north = None, south = None): inputdata = [ {} for i in range(6) ] dir_key = (self.TOP, self.BOTTOM, self.EAST, self.WEST, self.NORTH, self.SOUTH) for (key, value) in zip(dir_key, (top, bottom, east, west, north, south)): if value is not None : inputdata[self.__get_index(value = value)] = {self.stDIRECTION : self.DIRECTION[key], self.stVALUE: value } current_info = [ self.info[i] if inputdata[i] else {} for i in range(len(inputdata)) ] before_vectors = [] after_vectors = [] index = 0 for before, after in zip(current_info, inputdata): if before : for i in range(index): if np.dot( np.array(before_vectors[i]), np.array(before[self.stDIRECTION]) ) != 0 : break else : before_vectors.append( before[self.stDIRECTION] ) after_vectors .append( after[self.stDIRECTION] ) index += 1 if index > 1 : break if len(before_vectors) == 0 : return None elif len(before_vectors) == 1 : pass elif len(before_vectors) == 2 : before_vectors.append( tuple( np.cross( np.array(before_vectors[0]), np.array(before_vectors[1]) ) ) ) after_vectors .append( tuple( np.cross( np.array( after_vectors[0]), np.array( after_vectors[1]) ) ) ) before_vectors = np.array( before_vectors ).T after_vectors = np.array( after_vectors ).T operator_matrix = np.dot( after_vectors, np.linalg.inv( before_vectors ) ).astype(np.int) for before, after in zip(current_info, inputdata): if before : if after[self.stDIRECTION] != tuple( np.dot( operator_matrix, np.array(before[self.stDIRECTION]) ) ): return None for info in self.info: info[self.stDIRECTION] = tuple ( np.dot( operator_matrix, 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, vector = False): for info in self.info: if info[self.stVALUE] != value : continue if vector : return info[self.stDIRECTION] dir_key_values = self.DIRECTION.items() for items in dir_key_values: if info[self.stDIRECTION] in items: return items[0] #string def __get_index(self, dir_vector = None, value = None, dir_key = None): for i,info in enumerate(self.info): if (dir_vector is not None) or (dir_key is not None): if info[self.stDIRECTION] in (dir_vector, self.DIRECTION.get(dir_key)) : return i elif value is not None : if info[self.stVALUE] == value : return i def __matrix_product(self, matrix_left, matrix_right): return([ [sum( [matrix_left[i][j]*matrix_right[j][k] for j in range(len(matrix_right))] ) for k in range(len(matrix_right[0]))] for i in range(len(matrix_left)) ]) def __outer_product(self, vector_left, vector_right): #each vector must have 3 elements. return tuple( [ vector_left[i-2] * vector_right[i-1] - vector_left[i-1] * vector_right[i-2] for i in range(3)] ) 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()
s142109870
p02384
u279605379
1495094475
Python
Python3
py
Runtime Error
20
7600
330
#ITP1_11-B Dice 2 rep=[ [0,0,0,0,0], [2,3,5,4,2], [3,1,4,6,3], [1,2,6,5,1], [1,5,6,2,1], [1,3,6,4,1], [2,4,5,3,2] ] d = input().split(" ") q = int(input()) for i in range(q): a,b = [int(x) for x in input().split(" ")] for j in range(4): if(rep[a][j]==b): print(rep[a][j+1])
s092945818
p02384
u279605379
1495094490
Python
Python3
py
Runtime Error
20
7628
330
#ITP1_11-B Dice 2 rep=[ [0,0,0,0,0], [2,3,5,4,2], [3,1,4,6,3], [1,2,6,5,1], [1,5,6,2,1], [1,3,6,4,1], [2,4,5,3,2] ] d = input().split(" ") q = int(input()) for i in range(q): a,b = [int(x) for x in input().split(" ")] for j in range(4): if(rep[a][j]==b): print(rep[a][j+1])
s386898034
p02384
u821624310
1497868196
Python
Python3
py
Runtime Error
30
7620
463
class Dice: def __init__(self): self.face = {12:3, 13:5, 14:2, 15:4, 21:4, 23:1, 24:6, 26:3, 31:2, 32:6, 35:1, 36:5, 41:5, 42:1, 45:6, 46:2, 51:3, 53:6, 54:1, 56:4, 62:4, 63:2, 64:5, 65:3} def right_face(self, face): return self.face[face] d = Dice() dice = [dice for dice in input().split()] q = int(input()) for i in range(q): face = input().split() face = int("".join(face)) n = d.right_face(face) print(dice[n-1])
s506222403
p02384
u821624310
1497868329
Python
Python3
py
Runtime Error
30
7628
463
class Dice: def __init__(self): self.face = {12:3, 13:5, 14:2, 15:4, 21:4, 23:1, 24:6, 26:3, 31:2, 32:6, 35:1, 36:5, 41:5, 42:1, 45:6, 46:2, 51:3, 53:6, 54:1, 56:4, 62:4, 63:2, 64:5, 65:3} def right_face(self, face): return self.face[face] d = Dice() dice = [dice for dice in input().split()] q = int(input()) for i in range(q): face = input().split() face = int("".join(face)) n = d.right_face(face) print(dice[n-1])
s089439950
p02384
u821624310
1497868375
Python
Python3
py
Runtime Error
20
7584
463
class Dice: def __init__(self): self.face = {12:3, 13:5, 14:2, 15:4, 21:4, 23:1, 24:6, 26:3, 31:2, 32:6, 35:1, 36:5, 41:5, 42:1, 45:6, 46:2, 51:3, 53:6, 54:1, 56:4, 62:4, 63:2, 64:5, 65:3} def right_face(self, face): return self.face[face] d = Dice() dice = [dice for dice in input().split()] q = int(input()) for i in range(q): face = input().split() face = int("".join(face)) n = d.right_face(face) print(dice[n-1])
s175157289
p02384
u283452598
1503209827
Python
Python3
py
Runtime Error
30
7824
2164
class Dice(): def __init__(self,ary): self.top = ary[0] self.south = ary[1] self.east = ary[2] self.west = ary[3] self.north = ary[4] self.bottom = ary[5] def get_top(self): return self.top def rotate_north(self): self.top,self.south,self.north,self.bottom = self.south,self.bottom,self.top,self.north def rotate_south(self): self.top,self.south,self.north,self.bottom = self.north,self.top,self.bottom,self.south def rotate_west(self): self.top,self.west,self.bottom,self.east = self.east,self.top,self.west,self.bottom def rotate_east(self): self.top,self.west,self.bottom,self.east = self.west,self.bottom,self.east,self.top def rotate_horizon(self): self.south,self.east,self.north,self.west = self.west,self.south,self.east,self.north def get_east(self): return self.east dice = Dice(list(map(int,input().split()))) q = int(input()) for i in range(q): rot = list(map(int,input().split())) if rot[0]==dice.top: for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.west: dice.rotate_east() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.bottom: dice.rotate_east() dice.rotate_east() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.east: dice.rotate_west() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.north: dice.rotate_south() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.south(): dice.rotate_north() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() print(h)
s425334185
p02384
u283452598
1503209917
Python
Python3
py
Runtime Error
30
7744
2164
class Dice(): def __init__(self,ary): self.top = ary[0] self.south = ary[1] self.east = ary[2] self.west = ary[3] self.north = ary[4] self.bottom = ary[5] def get_top(self): return self.top def rotate_north(self): self.top,self.south,self.north,self.bottom = self.south,self.bottom,self.top,self.north def rotate_south(self): self.top,self.south,self.north,self.bottom = self.north,self.top,self.bottom,self.south def rotate_west(self): self.top,self.west,self.bottom,self.east = self.east,self.top,self.west,self.bottom def rotate_east(self): self.top,self.west,self.bottom,self.east = self.west,self.bottom,self.east,self.top def rotate_horizon(self): self.south,self.east,self.north,self.west = self.west,self.south,self.east,self.north def get_east(self): return self.east dice = Dice(list(map(int,input().split()))) q = int(input()) for i in range(q): rot = list(map(int,input().split())) if rot[0]==dice.top: for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.west: dice.rotate_east() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.bottom: dice.rotate_east() dice.rotate_east() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.east: dice.rotate_west() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.north: dice.rotate_south() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() elif rot[0]==dice.south(): dice.rotate_north() for _ in range(4): dice.rotate_horizon() if dice.south==rot[1]: h=dice.get_east() print(h)
s472354311
p02384
u972637506
1505754389
Python
Python3
py
Runtime Error
50
7648
665
class Converter: d = { "1 2": 2, "1 3": 4, "1 4": 1, "1 5": 3, "2 1": 3, "2 3": 0, "2 4": 5, "2 6": 2, "3 1": 1, "3 2": 5, "3 5": 0, "3 6": 4, "4 1": 4, "4 2": 0, "4 5": 5, "4 6": 1, "5 1": 2, "5 3": 5, "5 4": 0, "5 6": 3, "6 2": 3, "6 3": 1, "6 4": 4, "6 5": 2, } def __init__(self, s): self.pip = s.split() def __call__(self, s): print(self.pip[self.d[s]]) cv = Converter(input()) n = int(input()) for _ in range(n): cv(input())
s150540507
p02384
u480053997
1507874771
Python
Python3
py
Runtime Error
0
0
461
class Dice2(Dice1): def __init__(self, v): # v [Top, Front, Right, Left, Back, Bottom ] super().__init__(v) self.dTFR = {} for i, j, k in ((ii, (ii++2)%6, (ii+4)%6) for ii in range(6)): self.dTFR[self.view[i]]=[self.view[v] for v in (j, k, 5-j, 5-k, j)] d2, q = Dice2(list(map(int, input().split()))), int(input()) for i in range(q): t, f = map(int, input().split()) print(d2.dTFR[t][d2.dTFR[t].index(f)+1] )
s535719816
p02384
u480053997
1507874889
Python
Python3
py
Runtime Error
0
0
461
class Dice2(Dice1): def __init__(self, v): # v [Top, Front, Right, Left, Back, Bottom ] super().__init__(v) self.dTFR = {} for i, j, k in ((ii, (ii++2)%6, (ii+4)%6) for ii in range(6)): self.dTFR[self.view[i]]=[self.view[v] for v in (j, k, 5-j, 5-k, j)] d2, q = Dice2(list(map(int, input().split()))), int(input()) for i in range(q): t, f = map(int, input().split()) print(d2.dTFR[t][d2.dTFR[t].index(f)+1] )
s324885649
p02384
u379645513
1512956442
Python
Python3
py
Runtime Error
0
0
3596
#include <queue> #include <vector> #include <string> #include <cassert> #include <iostream> #include <algorithm> enum class Direction { North = 0, East, South, West, }; struct Number { Number(int t, int f, int r, int l, int b, int btm) :top(t), front(f), right(r), left(l), back(b), bottom(btm) {} int top; int front; int right; int left; int back; int bottom; }; bool operator==(const Number &lhs, const Number &rhs) { return lhs.top == rhs.top && lhs.front == rhs.front && lhs.right == rhs.right && lhs.left == rhs.left && lhs.back == rhs.back && lhs.bottom == rhs.bottom; } class Dice { public: explicit Dice(const Number &number) :number_(number) {} Dice rotate_to(Direction direction) const { const Number number = [&](Direction direction) { switch(direction) { default: assert(!"Invalid Direction."); case Direction::North: return Number(number_.front, number_.bottom, number_.right, number_.left, number_.top, number_.back); case Direction::East: return Number(number_.left, number_.front, number_.top, number_.bottom, number_.back, number_.right); case Direction::South: return Number(number_.back, number_.top, number_.right, number_.left, number_.bottom, number_.front); case Direction::West: return Number(number_.right, number_.front, number_.bottom, number_.top, number_.back, number_.left); } }(direction); return Dice(number); } Number number() const { return number_; } private: Number number_; }; bool operator==(const Dice &lhs, const Dice &rhs) { return lhs.number() == rhs.number(); } Dice make_dice() { int top, front, right, left, back, bottom; std::cin >> top >> front >> right >> left >> back >> bottom; Number number(top, front, right, left, back, bottom); Dice dice(number); return dice; } bool exist(const Dice & dice, const std::vector<Dice> &memo) { return std::find(memo.begin(), memo.end(), dice) != memo.end(); } int solve_core(std::queue<Dice> &dices, std::vector<Dice> &memo, int top, int front) { const std::vector<Direction> directions = { Direction::North, Direction::East, Direction::South, Direction::West }; while(true) { for(const auto &direction : directions) { const auto dice = dices.front().rotate_to(direction); const auto number = dice.number(); if(number.top == top && number.front == front) { return number.right; } if(exist(dice, memo)) { continue; } dices.push(dice); } dices.pop(); } } std::vector<int> solve() { const auto dice = make_dice(); int questions; std::cin >> questions; std::vector<int> ans; for(int i = 0; i < questions; ++i) { int top, front; std::cin >> top >> front; std::vector<Dice> memo = { dice }; std::queue<Dice> dices; dices.push(dice); ans.push_back(solve_core(dices, memo, top, front)); } return ans; } int main() { const auto ans = solve(); for(const auto &e : ans) { std::cout << e << std::endl; } return 0; }
s113432104
p02384
u150984829
1516370767
Python
Python3
py
Runtime Error
0
0
224
d=input().split() n={0:(1,2,4,3,1),1:(0,3,5,2,0),2:(0,1,5,4,0),3:(1,0,4,5,1),4:(0,2,5,3,0),5:(1,3,4,2,1)} for _ in range(int(input())): t,f=[d.index(s) for s in input().split()] n=n[int(t)] print(d[n[n.index(int(f))+1]])
s263632012
p02384
u267728784
1516758847
Python
Python3
py
Runtime Error
0
0
881
def face(x,y,dice): if (x==dice[5] and y==dice[4])or(x==dice[4] and y==dice[0])or(x==dice[0] and y==dice[1])or(x==dice[1] and y==dice[5]): return dice[2] elif (x==dice[0] and y==dice[2])or(x==dice[2] and y==dice[5])or(x==dice[5] and y==dice[3])or(x==dice[3] and y==dice[0]): return dice[4] elif (y==dice[5] and x==dice[4])or(y==dice[4] and x==dice[0])or(y==dice[0] and x==dice[1])or(y==dice[1] and x==dice[5]): return dice[3] elif (y==dice[0] and x==dice[2])or(y==dice[2] and x==dice[5])or(y==dice[5] and x==dice[3])or(y==dice[3] and x==dice[0]): return dice[1] elif (x==dice[2] and y==dice[1])or(x==dice[1] and y==dice[3])or(x==dice[3] and y==dice[4])or(x==dice[4] and y==dice[2]): return dice[5] else: return dice[0] for i in range(n): a,b=map(int,raw_input().split()) print face(a,b,l)
s521433426
p02384
u088372268
1517446928
Python
Python3
py
Runtime Error
20
5608
1086
class Dice: def __init__(self, top, dside): self.top = top self.dside = dside self.rside = None self.num = [self.top, self.dside, 7-self.top, 7-self.dside] def rside_num(self): if 2 in self.num and 3 in self.num: if(self.num.index(3)==self.num.index(2)+1 or self.num==[3, 5, 4, 2]): self.rside = 1 else: self.rside = 6 elif 1 in self.num and 4 in self.num: if(self.num.index(4)==self.num.index(1)+1 or self.num==[3, 6, 4, 1]): self.rside = 2 else: self.rside = 5 else: if(self.num.index(2)==self.num.index(1)+1 or self.num==[2, 6, 5, 1]): self.rside = 3 else: self.rside = 4 num = list(map(int, input().split())) n = int(input()) for i in range(n): value = list(map(int, input().split())) dice = Dice((num.index(value[0])+1), (num.index(value[1]+1))) dice.rside_num() print(dice.rside)
s586698721
p02384
u886729200
1523029737
Python
Python3
py
Runtime Error
0
0
1443
class Dice2(): def front(self,up,front,dice): #index == 5 if (up==dice[2] and front==dice[1]) or(up==dice[1] and front==dice[3]) or(up==dice[3] and front==dice[4]) or(up==dice[4] and front==dice[2]): return dice[5] #index == 4 elif (up==dice[0] and front==dice[2]) or(up==dice[2] and front==dice[5]) or(up==dice[5] and front==dice[3]) or(up==dice[3] and front==dice[0]): return dice[4] #index == 3 elif (front==dice[5] and up==dice[4]) or(front==dice[4] and up==dice[0]) or(front==dice[0] and up==dice[1]) or(front==dice[1] and up==dice[5]): return dice[3] #index == 2 elif (up==dice[5] and front==dice[4]) or(up==dice[4] and front==dice[0]) or(up==dice[0] and front==dice[1]) or(up==dice[1] and front==dice[5]): return dice[2] #index == 1 elif (front==dice[0] and up==dice[2]) or(front==dice[2] and up==dice[5]) or(front==dice[5] and up==dice[3]) or(front==dice[3] and up==dice[0]): return dice[1] #index == 0 else: return dice[0] dice = [int(i) for i in input().split()] p = int(input()) dc2 = Dice2() ans = [] for i in range(p): up,front = map(int,input().split()) ans.append(dc2.front(up,front,dice)) for i in range(p): print(ans[i])
s628488130
p02384
u908651435
1526752468
Python
Python3
py
Runtime Error
0
0
883
class Dice: def __init__(self,t,f,r,l,b,u): self.t = t self.f = f self.r = r self.l = l self.b = b self.u = u self.a=[t,f,r,l,b,u] self.direction={'S':(4,0,2,3,5,1),'N':(1,5,2,3,0,4),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3),'Y':(0,3,1,4,2,5)} def roll(self,d): self.a=[self.a[i] for i in self.direction[d]] self.t = self.a[0] self.f = self.a[1] self.r = self.a[2] self.l = self.a[3] self.b = self.a[4] self.u = self.a[5] t,f,r,l,b,u=map(int,input().split()) dice1=Dice(t,f,r,l,b,u) t,f,r,l,b,u=map(int,input().split()) dice2=Dice(t,f,r,l,b,u) s='SSSEWW' w='YYY' ans='No' for j in s: for r in w: if dice1.a==dice2.a: ans='Yes' break dice2.roll(r) else: dice2.roll(j) continue break print(ans)
s136830647
p02384
u657361950
1528472237
Python
Python3
py
Runtime Error
0
0
1485
class Dice: def __init__(self, faces): self.t = faces[0] self.s = faces[1] self.e = faces[2] self.w = faces[3] self.n = faces[4] self.b = faces[5] def roll(self, drct): t_ = self.t s_ = self.s e_ = self.e w_ = self.w n_ = self.n b_ = self.b if drct == 'S': self.t = def set_top(self, face): if self.t == face: return elif self.s == face: self.roll('N') elif self.e == face: self.roll('W') elif self.w == face: self.roll('E') elif self.n == face: self.roll('S') else self.roll('N') self.roll('N')_ self.s = t_ self.n = b_ self.b = s_ elif drct == 'N': self.t = s_ self.s = b_ self.n = t_ self.b = n_ elif drct == 'E': self.t = w_ self.e = t_ self.w = b_ self.b = e_ elif drct == 'W': self.t = e_ self.e = b_ self.w = t_ self.b = w_ else: return def set_top(self, face): if self.t == face: return elif self.s == face: self.roll('N') elif self.e == face: self.roll('W') elif self.w == face: self.roll('E') elif self.n == face: self.roll('S') else: self.roll('N') self.roll('N') def get_right_face(self, f): if self.s == f: return self.e elif self.e == f: return self.n elif self.w == f: return self.s else: return self.w faces = list(map(int, input().split())) dice = Dice(faces) n = int(input()) for i in range(n): t, f = map(int, input().split()) dice.set_top(t) print(dice.get_right_face(f))
s256933961
p02385
u869301406
1530960566
Python
Python3
py
Runtime Error
0
0
2640
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): self.__find_num(self.dice1_top, self.dice2) if self.dice1_front not in self.dice2.rows: self.dice2.move_prev_cols() self.__find_num(self.dice1_front, self.dice2) while self.dice1_top != self.dice2.rows[0]: self.dice2.move_next_rows() 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 self.__rot(self.dice2) is_rot_same = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols if is_same_element or is_rot_same: is_same = True else: is_same = False self.dice2.move_next_cols() self.dice2.move_next_rows() 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()
s417920723
p02385
u175224634
1556900596
Python
Python3
py
Runtime Error
0
0
1242
class Dice :     same_dice_index = ('123456' , '135246' , '142536' , '154326' ,                        '214365' , '231645' , '246135' , '263415',                        '312564' , '326154' , '351624' , '365214',                        '415263' , '421653' , '456123' , '462513',                        '513462' , '536142' , '541632' , '564312',                        '624351' , '632541' , '645231' , '653421') def __init__ ( self , num_list ) :         self.faces = num_list        def is_same ( self , dice ) :         for i in Dice.same_dice_index :             example_faces = [ ]             for j in i :                 example_faces.append ( self.faces [ int ( j ) - 1 ] )             if example_faces == dice.faces :                 return 'Yes'         return 'No'   num_list1 = list ( map ( int , input ( ).split ( ) ) ) num_list2 = list ( map ( int , input ( ).split ( ) ) )   dice1 = Dice ( num_list1 ) dice2 = Dice ( num_list2 )   ans = dice1.is_same ( dice2 )   print ( ans )
s157912331
p02385
u175224634
1556900634
Python
Python3
py
Runtime Error
0
0
1693
class Dice:     def __init__(self):         self.u=1         self.w=2         self.s=3         self.e=4         self.n=5         self.d=6         self.dic={"W":0,"S":1,"E":2,"N":3}           def __init__(self,u,w,s,e,n,d):         self.u=u         self.w=w         self.s=s         self.e=e         self.n=n         self.d=d         self.dic={"W":0,"S":1,"E":2,"N":3}       def rot(self,way):         if isinstance(way,str):             way=self.dic[way]           if(way==0):             c=self.u             self.u=self.e             self.e=self.d             self.d=self.w             self.w=c         elif way==1:             c=self.u             self.u=self.n             self.n=self.d             self.d=self.s             self.s=c         elif way==2:             c=self.u             self.u=self.w             self.w=self.d             self.d=self.e             self.e=c   import random u,s,e,w,n,d=map(int,input().split()) dice=Dice(u,w,s,e,n,d) u,s,e,w,n,d=map(int,input().split()) dice_b=Dice(u,w,s,e,n,d) ok=False for i in range (1000):     dice.rot(random.randint(0,3))     if(dice.u==dice_b.u and dice.d==dice_b.d and dice.w==dice_b.w and dice.s==dice_b.s and dice.e==dice_b.e and dice.n==dice_b.n):         ok=True if ok:     print('Yes') else :     print('No')
s901826635
p02385
u764759179
1559020429
Python
Python3
py
Runtime Error
0
0
1331
#!/usr/bin/env python3 # coding: utf-8 class Dice() : mask = {'N':(1,5,2,3,0,4), 'E':(3,1,0,5,4,2), 'W':(2,1,5,0,4,3), 'S':(4,0,2,3,5,1),'CW':(0,2,4,1,3,5)} way = ("N","E","W","S","CW","Nop") def __init__(self, data): self.label = data def move(self, data): if data == "Nop" return self.label = [self.label[idx] for idx in self.mask[data]] def get_up(self): return self.label[0] def compare_6sq(self, dice2): check = True for i in range(6): if self.label[i] == dice2.label[i] : continue else: check = False break return check def compare_4rot(self, dice2): ok = False for i in range(4): self.move("CW") if self.compare_6sq(dice2) : ok =True break return ok def compare(self,dice2) ok = False orderway =("Nop","E","N","E","N","E") for s in orderway: self.move(s) if self.compare_4rot(dice2): ok = True break return ok dice1 = Dice(input().split()) dice2 = Dice(input().split()) if dice1.compare(dice2) : print ("Yes") else: print ("No")
s195282038
p02385
u067975558
1423789336
Python
Python3
py
Runtime Error
0
0
753
class Dice: def __init__(self, data): self.data = data def judge(self, dice): if self.data[0] != dice[0]: for i in range(4): if self.data[0] == dice[0]: break self.move('E') for i in range(4): if self.data[0] == dice[0]: break self.move('N') if self.data[1] != dice[1]: for i in range(3): self.move('R') if self.data[1] == dice[1]: break if self.data[2] == dice[2]: return 'Yes' else: return 'No' dice = Dice(input().split()) hoge = [i for i in input().split()] print(dice.judge(hoge))
s237872415
p02385
u067975558
1423790118
Python
Python3
py
Runtime Error
0
0
1668
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] elif direction == 'R': self.data[1],self.data[2], self.data[4], self.data[3] = \ self.data[2],self.data[4], self.data[3], self.data[1] def judge(self, dice): if self.data[0] != dice[0]: for i in range(4): if self.data[0] == dice[0]: break self.move('E') for i in range(4): if self.data[0] == dice[0]: break self.move('N') if self.data[1] != dice[1]: for i in range(3): self.move('R') if self.data[1] == dice[1]: break for i in range(2,7): if self.data[i] != dice[i]: return 'No' return 'Yes' dice = Dice(input().split()) hoge = [i for i in input().split()] print(dice.judge(hoge))
s848465747
p02385
u067975558
1423790218
Python
Python3
py
Runtime Error
0
0
1697
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] elif direction == 'R': self.data[1],self.data[2], self.data[4], self.data[3] = \ self.data[2],self.data[4], self.data[3], self.data[1] return self.data[2] def judge(self, dice): if self.data[0] != dice[0]: for i in range(4): if self.data[0] == dice[0]: break self.move('E') for i in range(4): if self.data[0] == dice[0]: break self.move('N') if self.data[1] != dice[1]: for i in range(3): self.move('R') if self.data[1] == dice[1]: break for i in range(2,7): if self.data[i] != dice[i]: return 'No' return 'Yes' dice = Dice(input().split()) hoge = [i for i in input().split()] print(dice.judge(hoge))
s369190051
p02385
u067975558
1423794080
Python
Python3
py
Runtime Error
0
0
1955
class Dice: def __init__(self, data): self.data = data def __eq__(self, value): for i in range(4): if self.data[0] == value.data[0]: for j in range(4): if self.data == value.data: return True self.move('N') self.move('E') return False 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] elif direction == 'R': self.data[1],self.data[2], self.data[4], self.data[3] = \ self.data[2],self.data[4], self.data[3], self.data[1] def getTop(self): return self.data[0] def getRight(self, top, front): if self.data[0] != top: for i in range(4): if self.data[0] == top: break self.move('E') for i in range(4): if self.data[0] == top: break self.move('N') if self.data[1] != front: for i in range(3): self.move('R') if self.data[1] == front and self.data[0] == top: break return self.data[2] dice = Dice(input().split()) hoge = [i for i in input().split()] print(dice.judge(hoge))
s996669210
p02385
u131984977
1423795722
Python
Python3
py
Runtime Error
0
0
2295
class Dice: def __init__(self, data): self.data = data def __eq__(self, value): for a in range(0,6,5): self.moveTopTo(self.getSortedList()[a]) value.moveTopTo(value.getSortedList()[a]) for b in range(4): print(self.data, value.data) if self.data == value.data: return True else: value.move('R') return False 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] elif direction == 'R': self.data[1], self.data[2], self.data[4], self.data[3] = \ self.data[3], self.data[1], self.data[2], self.data[4] elif direction == 'L': self.data[1], self.data[2], self.data[4], self.data[3] = \ self.data[2], self.data[4], self.data[3], self.data[1] def moveTopTo(self, target): for a in range(4): if self.data[0] == target: break self.move('W') if self.data[4] == target: self.move('S') elif self.data[1] == target: self.move('N') def moveFrontTo(self, target): for a in range(4): if self.data[1] == target: break self.move('R') def getTop(self): return self.data[0] def getRight(self): return self.data[2] def getSortedList(self): tmp = self.data[:] tmp.sort() return tmp from Dice import Dice a = Dice(input().split()) b = Dice(input().split()) if a == b: print('Yes') else: print('No')
s451040921
p02385
u604774382
1432369157
Python
Python
py
Runtime Error
0
0
1764
class Dice: def __init__( self, nums ): self.face = nums def rolltoTopIndex( self, faceindex ): if faceindex == 1: self.roll( "N" ) elif faceindex == 2: self.roll( "W" ) elif faceindex == 3: self.roll( "E" ) elif faceindex == 4: self.roll( "S" ) elif faceindex == 5: self.roll( "NN" ) def roll( self, actions ): for act in actions: t = 0 if act == "E": t = self.face[0] self.face[0] = self.face[3] self.face[3] = self.face[5] self.face[5] = self.face[2] self.face[2] = t elif act == "N": t = self.face[0] self.face[0] = self.face[1] self.face[1] = self.face[5] self.face[5] = self.face[4] self.face[4] = t elif act == "S": t = self.face[ 0] self.face[0] = self.face[4] self.face[4] = self.face[5] self.face[5] = self.face[1] self.face[1] = t elif act == "W": t = self.face[0] self.face[0] = self.face[2] self.face[2] = self.face[5] self.face[5] = self.face[3] self.face[3] = t elif act == "M": t = self.face[1] self.face[1] = self.face[2] self.face[2] = self.face[4] self.face[4] = self.face[3] self.face[3] = t diceface = [ int( val ) for val in input( ).split( " " ) ] dice1 = Dice( diceface ) diceface = [ int( val ) for val in input( ).split( " " ) ] dice2 = Dice( diceface ) cnt = 0 for i in range( 6 ): if dice1.face[0] == dice2.face[i]: dice2.rolltoTopIndex( i ) for j in range( 1, 5 ) if dice1.face[1] == dice2.face[1]: cnt = 0 for k in range( 6 ): if dice1.face[k] == dice2.face[k]: cnt += 1 if cnt == 6 break dice2.roll( "M" ) if cnt == 6 break dice2.face = diceface if cnt == 6: print( "Yes" ) else: print( "No" )
s640480545
p02385
u633068244
1433166280
Python
Python
py
Runtime Error
0
0
1388
import random class Dice: def __init__(self, top, front, right, left, back, bottom): self.top, self.bottom = top, bottom self.right, self.left = right, left self.front, self.back = front, back 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 same(a, b): if ((a.top, a.bottom, a.right, a.left, a.front, a.back) == (b.top, b.bottom, b.right, b.left, b.front, b.back)): return True else: return False ref = {} ls1 = map(int, raw_input().split()) ls2 = map(int, raw_input().split()) dice1 = Dice(ls1[0], ls1[1], ls1[2], ls1[3], ls1[4], ls1[5]) dice2 = Dice(ls2[0], ls2[1], ls2[2], ls2[3], ls2[4], ls2[5]) for i in xrange(1000): d = "NSEW"[random.randint(0,3)] dice1.rot(d) if same(dice1, dice2): print "Yes" break else: print "No"
s832954422
p02385
u571345655
1435338160
Python
Python
py
Runtime Error
20
4360
1851
# coding=utf-8 class Dice(object): def __init__(self, list_): self.label = list_ def getLabel(self, i): return self.label[i - 1] def _rotateS(self): self.label = [self.getLabel(i) for i in [5, 1, 3, 4, 6, 2]] def _rotateN(self): self.label = [self.getLabel(i) for i in [2, 6, 3, 4, 1, 5]] def _rotateE(self): self.label = [self.getLabel(i) for i in [4, 2, 1, 6, 5, 3]] def _rotateW(self): self.label = [self.getLabel(i) for i in [3, 2, 6, 1, 5, 4]] def _spinPos(self): self.label = [self.getLabel(i) for i in [1, 4, 2, 5, 3, 6]] def _spinNeg(self): self.label = [self.getLabel(i) for i in [1, 3, 5, 2, 4, 6]] def rotate(self, rotates): for r in rotates: if r == 'S': self._rotateS() elif r == 'N': self._rotateN() elif r == 'E': self._rotateE() elif r == 'W': self._rotateW() elif r == 'T': self._spinPos() elif r == 'B': self._spinNeg() def matchTopFront(self, top, front): iTop = self.label.index(top) + 1 topRot = {1: '', 2: 'N', 3: 'W', 4: 'E', 5: 'S', 6: 'SS'} self.rotate(topRot[iTop]) iFront = self.label.index(front) + 1 frontRot = {2: '', 3: 'B', 4: 'T', 5: 'TT'} self.rotate(frontRot[iFront]) def main(): face1 = map(int, raw_input().split()) face2 = map(int, raw_input().split()) if set(face1) != set(face2): print 'No' else: d1 = Dice(face1) d2 = Dice(face2) d1Top = d1.getLabel(1) d1Front = d1.getLabel(2) d2.matchTopFront(d1Top, d1Front) print 'Yes' if d1.label == d2.label else 'No' if __name__ == '__main__': main()
s089962440
p02385
u777299405
1435908172
Python
Python3
py
Runtime Error
0
0
1387
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] def issame(self, other_dice): for i in range(4): for j in range(4): if self.faces == other_dice.faces: return True self.rotate() self.roll_north() for i in range(4): for j in range(4): if self.faces == other_dice.faces: return True self.rotate() self.roll_east() return False dice1 = Dice(list(map(int, input().split()))) dice2 = Dice(list(map(int, input().split()))) print("Yes" if dice1.issame(dice2) else "No")
s284357945
p02385
u512342660
1450968560
Python
Python
py
Runtime Error
10
6316
1715
#-*- coding:utf-8 -*- # for x in xrange(2): rolls1 = raw_input().split() rolls2 = raw_input().split() testpare = (rolls1[0],rolls1[5]) testparerev = (rolls1[5],rolls1[0]) rolls2pare = [(rolls2[0],rolls2[5]),(rolls2[2],rolls2[3]),(rolls2[1],rolls2[4])] #??????????????¢????????¢??§?????´??????????????????????????????????¢???? #??¨??¨????????¢?????£????????????????????´???????????¢???3????????¨??????????¢???????????????????????????? if testpare in rolls2pare: pareps = rolls2pare.index(testpare) revflag = False elif testparerev in rolls2pare: pareps = rolls2pare.index(testparerev) revflag = True else: pareps = -1 #?¬???????????????¢??\????????¨????????????????????£??????????¢???? #?????????????????????????????? li1 = [rolls1[1],rolls1[2],rolls1[4],rolls1[3]] # print pareps if pareps==0: if revflag: tmp = rolls2[2] rolls2[2] = rolls2[3] rolls2[3] = tmp li2 = [rolls2[1],rolls2[2],rolls2[4],rolls2[3]] elif pareps==1: if revflag: tmp = rolls2[1] rolls2[1] = rolls2[4] rolls2[4] = tmp li2 = [rolls2[0],rolls2[1],rolls2[5],rolls2[4]] elif pareps==2: if revflag: tmp = rolls2[0] rolls2[0] = rolls2[5] rolls2[5] = tmp li2 = [rolls2[0],rolls2[3],rolls2[5],rolls2[2]] else: matchflag = False #?????????????????´?¢???? # print li1 # print li2 i=0 j=li2.index(li1[0]) matchflag = True#else??\??£???????????´????????? for x in xrange(4): # print "%s : %s"%(li1[i],li2[j]) if li1[i]==li2[j]: j+=1 i+=1 else: matchflag =False break if i>4: i=0 if j>4: j=0 if matchflag: print "Yes" else: print "No"
s129652042
p02385
u512342660
1450968757
Python
Python
py
Runtime Error
10
6428
1728
#-*- coding:utf-8 -*- import sys rolls1 = raw_input().split() rolls2 = raw_input().split() testpare = (rolls1[0],rolls1[5]) testparerev = (rolls1[5],rolls1[0]) rolls2pare = [(rolls2[0],rolls2[5]),(rolls2[2],rolls2[3]),(rolls2[1],rolls2[4])] #??????????????¢????????¢??§?????´??????????????????????????????????¢???? #??¨??¨????????¢?????£????????????????????´???????????¢???3????????¨??????????¢???????????????????????????? if testpare in rolls2pare: pareps = rolls2pare.index(testpare) revflag = False elif testparerev in rolls2pare: pareps = rolls2pare.index(testparerev) revflag = True else: print "No" sys.exit(0) #?¬???????????????¢??\????????¨????????????????????£??????????¢???? #?????????????????????????????? li1 = [rolls1[1],rolls1[2],rolls1[4],rolls1[3]] # print pareps if pareps==0: if revflag: tmp = rolls2[2] rolls2[2] = rolls2[3] rolls2[3] = tmp li2 = [rolls2[1],rolls2[2],rolls2[4],rolls2[3]] elif pareps==1: if revflag: tmp = rolls2[1] rolls2[1] = rolls2[4] rolls2[4] = tmp li2 = [rolls2[0],rolls2[1],rolls2[5],rolls2[4]] elif pareps==2: if revflag: tmp = rolls2[0] rolls2[0] = rolls2[5] rolls2[5] = tmp li2 = [rolls2[0],rolls2[3],rolls2[5],rolls2[2]] else: print "No" sys.exit(0) #?????????????????´?¢???? # print li1 # print li2 i=0 j=li2.index(li1[0]) matchflag = True#else??\??£???????????´????????? for x in xrange(4): # print "%s : %s"%(li1[i],li2[j]) if li1[i]==li2[j]: j+=1 i+=1 else: matchflag =False break if i>4: i=0 if j>4: j=0 if matchflag: print "Yes" else: print "No"
s248653978
p02385
u512342660
1450969002
Python
Python
py
Runtime Error
10
6496
1728
#-*- coding:utf-8 -*- import sys rolls1 = raw_input().split() rolls2 = raw_input().split() testpare = (rolls1[0],rolls1[5]) testparerev = (rolls1[5],rolls1[0]) rolls2pare = [(rolls2[0],rolls2[5]),(rolls2[2],rolls2[3]),(rolls2[1],rolls2[4])] #??????????????¢????????¢??§?????´??????????????????????????????????¢???? #??¨??¨????????¢?????£????????????????????´???????????¢???3????????¨??????????¢???????????????????????????? if testpare in rolls2pare: pareps = rolls2pare.index(testpare) revflag = False elif testparerev in rolls2pare: pareps = rolls2pare.index(testparerev) revflag = True else: print "No" sys.exit(0) #?¬???????????????¢??\????????¨????????????????????£??????????¢???? #?????????????????????????????? li1 = [rolls1[1],rolls1[2],rolls1[4],rolls1[3]] # print pareps if pareps==0: if revflag: tmp = rolls2[2] rolls2[2] = rolls2[3] rolls2[3] = tmp li2 = [rolls2[1],rolls2[2],rolls2[4],rolls2[3]] elif pareps==1: if revflag: tmp = rolls2[1] rolls2[1] = rolls2[4] rolls2[4] = tmp li2 = [rolls2[0],rolls2[1],rolls2[5],rolls2[4]] elif pareps==2: if revflag: tmp = rolls2[0] rolls2[0] = rolls2[5] rolls2[5] = tmp li2 = [rolls2[0],rolls2[3],rolls2[5],rolls2[2]] else: print "No" sys.exit(0) #?????????????????´?¢???? # print li1 # print li2 i=0 j=li2.index(li1[0]) matchflag = True#else??\??£???????????´????????? for x in xrange(4): # print "%s : %s"%(li1[i],li2[j]) if li1[i]==li2[j]: j+=1 i+=1 else: matchflag =False break if i>3: i=0 if j>3: j=0 if matchflag: print "Yes" else: print "No"
s155073352
p02385
u896065593
1463705670
Python
Python3
py
Runtime Error
0
0
2573
# ?????¢??¨?????¢?????°?????????????????´?????¢?????°???????????????????????°?????? # ??????????????¢???????????????????????? class Dice: def __init__(self): self.top = 1 self.front = 2 self.right = 3 self.left = 4 self.back = 5 self.bottom = 6 # 2->1->5->6 def turnSouth(self): temp = self.top self.top = self.back self.back = self.bottom self.bottom = self.front self.front = temp return self # 4->1->3->6 def turnEast(self): temp = self.top self.top = self.left self.left = self.bottom self.bottom = self.right self.right = temp return self # 3->1->4->6 def turnWest(self): temp = self.top self.top = self.right self.right = self.bottom self.bottom = self.left self.left = temp return self # 5->1->2->6 def turnNorth(self): temp = self.top self.top = self.front self.front = self.bottom self.bottom = self.back self.back = temp return self # 2->3->5->4 def turnRight(self): temp = self.front self.front = self.right self.right = self.back self.back = self.left self.left = temp return self # 2->4->5->3 def turnLeft(self): temp = self.front self.front = self.left self.left = self.back self.back = self.right self.right = temp return self # Dice????????? myDice = Dice() # ?????????????????¶????????\??? myDice.top, myDice.front, myDice.right, myDice.left, myDice.back, myDice.bottom = input().split() # ???????????°q????¨??????\??????????????? q = int(input()) # ?????????????????????????????????????????¨?????? # ??????????±? ?????´??¢ ???????????????????????????(3) for i in range(0, q): # ????????????????????? ?????¢(1) ?????¢(2)??? question = list(input()) question = "".join(question).split() # ?????¢?????????????????????????????? for j in range(0, 3): if question[0] == myDice.top: break myDice.turnNorth() # ?????¢?????????????????????????????? for j in range(0, 3): if question[0] == myDice.top: break myDice.turnEast() # ??£??¢???????????????????????¢????????????????????¢ for j in range(0, 3): if question[1] == myDice.front: break myDice.turnRight() print("{0}".format(myDice.right))
s383031620
p02385
u896065593
1463706036
Python
Python3
py
Runtime Error
0
0
2581
# 2???????????????????????????????????????????????????????????°?????? # ??????????????¢???????????????????????? class Dice: def __init__(self): self.top = 1 self.front = 2 self.right = 3 self.left = 4 self.back = 5 self.bottom = 6 # 2->1->5->6 def turnSouth(self): temp = self.top self.top = self.back self.back = self.bottom self.bottom = self.front self.front = temp return self # 4->1->3->6 def turnEast(self): temp = self.top self.top = self.left self.left = self.bottom self.bottom = self.right self.right = temp return self # 3->1->4->6 def turnWest(self): temp = self.top self.top = self.right self.right = self.bottom self.bottom = self.left self.left = temp return self # 5->1->2->6 def turnNorth(self): temp = self.top self.top = self.front self.front = self.bottom self.bottom = self.back self.back = temp return self # 2->3->5->4 def turnRight(self): temp = self.front self.front = self.right self.right = self.back self.back = self.left self.left = temp return self # 2->4->5->3 def turnLeft(self): temp = self.front self.front = self.left self.left = self.back self.back = self.right self.right = temp return self def equals(self, Dice): if (self.top == Dice.top and self.front == Dice.front and self.bottom == Dice.bottom and self.back == Dice.back and self.right == Dice.right and self.left == Dice.left): return True else: return False # Dice????????? Dice1 = Dice() Dice2 = Dice() # ?????????????????¶????????\??? Dice1.top, Dice1.front, Dice1.right, Dice1.left, Dice1.back, Dice1.bottom = int(input().split()) Dice2.top, Dice2.front, Dice2.right, Dice2.left, Dice2.back, Dice2.bottom = int(input().split()) # ?????¢?????????????????????????????? for j in range(0, 3): if Dice1.top == Dice2.top: break Dice2.turnNorth() # ?????¢?????????????????????????????? for j in range(0, 3): if Dice1.top == Dice2.top: break Dice2.turnEast() # ??£??¢???????????????????????¢????????????????????¢ for j in range(0, 3): if Dice1.front == Dice2.front: break Dice2.turnRight() if Dice1.equals(Dice2): print("Yes") else: print("No")
s881848105
p02385
u589886885
1471873962
Python
Python3
py
Runtime Error
0
0
1025
class Dice(): def __init__(self, label): self.label = label def north(self): self.change([2, 6, 3, 4, 1, 5]) def west(self): self.change([3, 2, 6, 1, 5, 4]) def east(self): self.change([4, 2, 1, 6, 5, 3]) def south(self): self.change([5, 1, 3, 4, 6, 2]) def change(self, convert): num = [] for i in range(6): num.append(self.label[convert[i] - 1]) self.label = num def is_same_dice(self, another_dice): for i in range(6): if i % 2 == 0: self.north() else: self.west() for j in range(4): self.rotate() if self.label == another_dice: return True return False def main(): f = [int(x) for x in input().split()] s = [int(x) for x in input().split()] if Dice(f).is_same_dice(s): print('Yes') else: print('No') if __name__ == '__main__': main()
s168866061
p02385
u175111751
1477805122
Python
Python3
py
Runtime Error
0
0
918
import sys class Dice: def __init__(self, f): self.f = f[:] def to_top(self, index): if index == 1: self.roll('N') elif index == 2: self.roll('W') elif index == 3: self.roll('E') elif index == 4: self.roll('S') elif index == 5: self.roll('NN') return self def side_roll(self): t = self.f[1] self.f[1] = self.f[2] self.f[2] = self.f[4] self.f[4] = self.f[3] self.f[3] = t return self def all_face(self): faces = [] for i in range(0,6): t = Dice(self.f[:]) faces.append(t.to_top(i).f) for j in range(3): faces.append(t.side_roll().f) return faces d1, d2 = (Dice(list(input().split())) for _ in range(2)) fs = d1.all_face() print('Yes' if d2.f in fs else 'No')
s068895229
p02385
u801346721
1479295769
Python
Python3
py
Runtime Error
0
0
1644
d = list(map(int, input().split())) d2 = list(map(int, input().split())) class Dice(): def __init__(self, d): self.dice = d def InsSN(self, one, two, five, six): self.dice[0] = one self.dice[1] = two self.dice[4] = five self.dice[5] = six def InsWE(self, one, three, four, six): self.dice[0] = one self.dice[2] = three self.dice[3] = four self.dice[5] = six def S(self): one = self.dice[4] two = self.dice[0] five = self.dice[5] six = self.dice[1] self.InsSN(one, two, five, six) def N(self): one = self.dice[1] two = self.dice[5] five = self.dice[0] six = self.dice[4] self.InsSN(one, two, five, six) def W(self): one = self.dice[2] three = self.dice[5] four = self.dice[0] six = self.dice[3] self.InsWE(one, three, four, six) def E(self): one = self.dice[3] three = self.dice[0] four = self.dice[5] six = self.dice[2] self.InsWE(one, three, four, six) def roll(self, order): if order == 'S': self.S() elif order == 'N': self.N() elif order == 'E': self.E() elif order == 'W': self.W() status = 'unfinish' d1 = Dice(d) for order1 in 'NNN': for order2 in 'EEEE': d1.roll(order2) if d1 == d2: print('Yes') status = 'finish' d1.roll(order) if status == 'finish': break if status != 'finish': print('No')
s693655843
p02385
u546285759
1481024555
Python
Python3
py
Runtime Error
20
7740
1072
p = [(-1,2,4,1,3,-1), (3,-1,0,5,-1,2), (1,5,-1,-1,0,4), (4,0,-1,-1,5,1), (2,-1,5,0,-1,3), (-1,3,1,4,2,-1)] d1 = list(map(int, input().split())) top, front, right = d1[0], d1[1], d1[2] d2 = list(map(int, input().split())) d1 = {v: k for k, v in enumerate(d1)} d2 = {v: k for k, v in enumerate(d2)} boo = True if len(d1) == 6 and len(d2) == 6 else False if boo: x, y = d2[top], d2[front] if right == d2[p[x][y]]: print("Yes") else: print("No") else: d1 = [(k, v) for k, v in enumerate(d1)] d2 = [(k, v) for k, v in enumerate(d2)] for m in range(5, 1, -1): if d1[m][1] != d1[m-1][1]: x, y = d1[m][0], d1[m-1][0] t1, f1, r1 = d1[m][0], d1[m-1][0], d1[p[x][y]][0] break else: t1, f1, r1 = 0, 0, 0 for m in range(5, 1, -1): if d2[m][1] != d2[m-1][1]: x, y = d2[m][0], d2[m-1][0] t2, f2, r2 = d2[m][0], d2[m-1][0], d2[p[x][y]][0] if t2 == r1 and r2 == t1: print("Yes") else: print("No")
s165022350
p02385
u546285759
1481025217
Python
Python3
py
Runtime Error
20
7900
1188
p = [(-1,2,4,1,3,-1), (3,-1,0,5,-1,2), (1,5,-1,-1,0,4), (4,0,-1,-1,5,1), (2,-1,5,0,-1,3), (-1,3,1,4,2,-1)] d1 = list(map(int, input().split())) top, front, right = d1[0], d1[1], d1[2] d2 = list(map(int, input().split())) d1 = {v: k for k, v in enumerate(d1)} d2 = {v: k for k, v in enumerate(d2)} boo = True if len(d1) == 6 and len(d2) == 6 else False if boo: x, y = d2[top], d2[front] adjacent = {v: k for k, v in d2.items()} try: if right == adjacent[p[x][y]]: print("Yes") else: print("No") except KeyError: print("No") else: d1 = [(k, v) for k, v in enumerate(d1)] d2 = [(k, v) for k, v in enumerate(d2)] for m in range(5, 1, -1): if d1[m][1] != d1[m-1][1]: x, y = d1[m][0], d1[m-1][0] t1, f1, r1 = d1[m][0], d1[m-1][0], d1[p[x][y]][0] break else: t1, f1, r1 = 0, 0, 0 for m in range(5, 1, -1): if d2[m][1] != d2[m-1][1]: x, y = d2[m][0], d2[m-1][0] t2, f2, r2 = d2[m][0], d2[m-1][0], d2[p[x][y]][0] if t2 == r1 and r2 == t1: print("Yes") else: print("No")
s374591764
p02385
u494314211
1481451102
Python
Python3
py
Runtime Error
0
0
662
d1=list(map(int,input().split())) d2=list(map(int,input().split())) 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(d1) dice2=dice(d2) if sorted(d1)!=sorted(d2): print("No") else: c=["E","W","S","N"] import random for i in l: n=0 while n<10**5: if dice1.d==dice2.d: break else: dice1.roll(c[random.randint(1,2)]) n+=1 if n>10**5: print("No") else: print("Yes")
s802986933
p02385
u771917453
1481474913
Python
Python
py
Runtime Error
10
6444
1824
class Dice: index_list_map = [[[-1],[2,3,4,5],[4,1,3,5],[1,4,2,5],[3,2,1,5],[-1]], [[3,2,5,4],[-1],[0,5,3,4],[5,0,2,4],[-1],[2,3,0,4]], [[1,4,5,3],[5,0,4,3],[-1],[-1],[0,5,1,3],[4,1,0,3]], [[4,1,5,2],[0,5,4,2],[-1],[-1],[5,0,1,2],[1,4,0,2]], [[2,3,5,1],[-1],[5,0,3,1],[0,5,2,1],[-1],[3,2,0,1]], [[-1],[3,2,4,0],[1,4,3,0],[4,1,2,0],[2,3,1,0],[-1]]] def __init__(self,list): self.num = list def lookup_east_side(self,u,s): index_upside = u index_sside = s return self.num[self.index_list_map[index_upside][index_sside][0]] def lookup_west_side(self,u,s): index_upside = u index_sside = s return self.num[self.index_list_map[index_upside][index_sside][1]] def lookup_north_side(self,u,s): index_upside = u index_sside = s return self.num[self.index_list_map[index_upside][index_sside][2]] def lookup_down_side(self,u,s): index_upside = u index_sside = s return self.num[self.index_list_map[index_upside][index_sside][3]] spots1 = map(int,raw_input().split()) spots2 = map(int,raw_input().split()) s2_index_u = [ i for i,x in enumerate(spots2) if x == spots1[0]] s2_index_s = [ i for i,x in enumerate(spots2) if x == spots1[1]] combinations_u_s = [ [x,y] for x in s2_index_u for y in s2_index_s if x != y ] dice2 = Dice(spots2) for comb in combinations_u_s : e = dice2.lookup_east_side(comb[0],comb[1]) w = dice2.lookup_west_side(comb[0],comb[1]) n = dice2.lookup_north_side(comb[0],comb[1]) d = dice2.lookup_down_side(comb[0],comb[1]) if e == spots1[2] and w == spots1[3] and n == spots1[4] and d == spots1[5]: print "Yes" quit() print "No"
s889753614
p02385
u918276501
1484511069
Python
Python3
py
Runtime Error
20
7512
323
def ch3(t,s,e): for j in R: if e in j: continue return(0 if (e == R.index(j)) ^ ((j.index(t) - j.index(s)) %4 == 3) else 1) break R = ((1,2,4,3),(2,0,3,5),(0,1,5,4)) f,g = input().split(), input().split() t,s,e,w,n,b = map(f.index, g) print('Yes' if ch3(t,s,e)*ch3(w,n,b) else 'No')
s062153169
p02385
u519227872
1486397831
Python
Python3
py
Runtime Error
20
7732
1593
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_top(self): return eval("self." + 'l' + str(self.top)) def get_right(self): return eval("self." + 'l' + str(self.right)) def get_front(self): return eval("self." + 'l' + str(self.front)) 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 def match_top(dice,target): for i in range(4): dice.move('S') if dice.get_top() == target: return dice return false l = list(map(int,input().split())) d1 = Dice(l[0],l[1],l[2],l[3],l[4],l[5]) l = list(map(int,input().split())) d2 = Dice(l[0],l[1],l[2],l[3],l[4],l[5]) d1_top = d1.get_top() d1_front = d1.get_front() d1_right = d1.get_right() ret = match_top(d2,d1_top) if ret == False: d2.move('E') ret = match_top(d2,d1_top) if ret == False: print('No') else: matched = False for i in range(4): d2.rot() if d2.get_front() == d1_front and d2.get_right() == d1_right: matched = True print ('Yes') break if not matched: print('No')
s574096431
p02385
u782850499
1492330332
Python
Python3
py
Runtime Error
20
7688
1377
dice_a = list(map(int,input().split())) dice_b = list(map(int,input().split())) dice_a_roll = [] for i in range(6): if dice_a[i] == dice_b[0]: b_top = i + 1 if dice_a[i] == dice_b[1]: b_front = i + 1 if b_top == 1: order=[2,3,5,4,2,3,5] for k in range(4): if b_front == order[k]: spots = [1, order[k], order[k+1], order[k+3], order[k+2], 6] elif b_top == 2: order=[6,3,1,4,6,3,1] for k in range(4): if b_front == order[k]: spots = [2, order[k], order[k+1], order[k+3], order[k+2], 5] elif b_top == 3: order=[2,6,5,1,2,6,5] for k in range(4): if b_front == order[k]: spots = [3, order[k], order[k+1], order[k+3], order[k+2], 4] elif b_top == 4: order=[2,1,5,6,2,1,5] for k in range(4): if b_front == order[k]: spots = [4, order[k], order[k+1], order[k+3], order[k+2], 3] elif b_top == 5: order=[1,3,6,4,1,3,6] for k in range(4): if b_front == order[k]: spots = [5, order[k], order[k+1], order[k+3], order[k+2], 2] elif b_top == 6: order=[2,4,5,3,2,4,5] for k in range(4): if b_front == order[k]: spots = [6, order[k], order[k+1], order[k+3], order[k+2], 1] for l in spots: dice_a_roll.append(dice_a[l-1]) if dice_a_roll == dice_b: print("Yes") else: print("No")
s576503453
p02385
u395334793
1498719039
Python
Python3
py
Runtime Error
0
0
265
Dice1 = list(input().split()) Dice2 = list(input().split()) a = list b = 1 for q in range(3): if Dice1[q] == Dice2[q]: a[q] = 1 else : a[q] = -1 for q in range(3): b = b*a[q] if b == 1 : print("Yes") elif b == -1 : print("No")
s770885846
p02385
u299798926
1499572741
Python
Python3
py
Runtime Error
20
7820
1121
import sys x1=[int(i)for i in input().split()] x2=[int(i)for i in input().split()] for i in range(6): if x2[i]==x1[0]: if x2[5-i]==x1[5]: count=i break if x2[count]==x1[0] and x2[5-count]==x1[5]: if count==0 or count==5: if count==5: for i in range(2): x2[1],x2[0]=x2[0],x2[1] x2[5],x2[1]=x2[1],x2[5] x2[4],x2[5]=x2[5],x2[4] else: if count==1 or count==4: while x1[0]!=x2[0]: x2[1],x2[0]=x2[0],x2[1] x2[5],x2[1]=x2[1],x2[5] x2[4],x2[5]=x2[5],x2[4] else: while x1[0]!=x2[0]: x2[3],x2[0]=x2[0],x2[3] x2[5],x2[3]=x2[3],x2[5] x2[2],x2[5]=x2[5],x2[2] for i in range(4): if x2[2]==x1[2] and x2[3]==x1[3] and x2[4]==x1[4] and x2[1]==x1[1] : print('Yes') break else: x2[1],x2[2]=x2[2],x2[1] x2[2],x2[4]=x2[4],x2[2] x2[4],x2[3]=x2[3],x2[4] if i==3: print('No') else: print("No")
s121621224
p02385
u914146430
1500470595
Python
Python3
py
Runtime Error
0
0
1028
class dice2(): def __init__(self,men1,men2,men3,men4,men5,men6): self.men=[men1,men2,men3,men4,men5,men6] def find_num_rside(self,top,front): t=self.men.index(top)+1 f=self.men.index(front)+1 if [t,f] in [[1,2],[2,6],[6,5],[5,1]]: return self.men[3-1]#3 elif [t,f] in [[5,6],[6,2],[2,1],[1,5]]: return self.men[4-1]#4 elif [t,f] in [[4,2],[2,3],[3,5],[5,4]]: return self.men[1-1]#1 elif [t,f] in [[5,3],[3,2],[2,4],[4,5]]: return self.men[6-1]#6 elif [t,f] in [[1,3],[3,6],[6,4],[4,1]]: return self.men[5-1]#5 elif [t,f] in [[4,6],[6,3],[3,1],[1,4]]: return self.men[2-1]#2 else: return "no_match" D1=dice2(*d1) D2=dice2(*d2) i=0 while True: one=D1.find_num_rside(d2[i], d2[i+1]) two=D2.find_num_rside(d2[i], d2[i+1]) if one!=two: print("No") break i+=2 if i==6: print("Yes") break
s831648977
p02385
u150984829
1513326181
Python
Python3
py
Runtime Error
20
5608
359
d,e=[list(map(int,input().split()))for _ in range(2)] m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])] f=[str(e[i])for i in range(1,5)]+[str(e[1])] f[2],f[3]=f[3],f[2] g=[str(d[int(i)])for i in m] g[2],g[3]=g[3],g[2] g=list(''.join(g)*2) for i in range(4): if g[g.index(f[i])+1]!=f[i+1]:print('No');break else: if i==3:print('Yes')
s711126795
p02385
u150984829
1513326882
Python
Python3
py
Runtime Error
20
5604
353
d,e=[list(map(int,input().split()))for _ in range(2)] m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])] f=[str(e[i])for i in range(1,5)]+[str(e[1])] f[2],f[3]=f[3],f[2] g=[str(d[int(i)])for i in m] g[2],g[3]=g[3],g[2] g=list(''.join(g)*2) for i in range(4): if g[g.index(f[i])+1]!=f[i+1]:print('No');break elif i==3:print('Yes')
s938636870
p02385
u150984829
1513327291
Python
Python3
py
Runtime Error
20
5608
337
d,e=[list(map(int,input().split()))for _ in range(2)] m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])] f=[str(e[i])for i in range(1,5)]+[str(e[1])] f[2],f[3]=f[3],f[2] g=[str(d[int(i)])for i in m] g[2],g[3]=g[3],g[2] g+=g for i in range(4): if g[g.index(f[i])+1]!=f[i+1]:print('No');break elif i==3:print('Yes')
s524062250
p02385
u150984829
1513327678
Python
Python3
py
Runtime Error
20
5608
337
d,e=[list(map(int,input().split()))for _ in range(2)] m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])] f=[str(e[i])for i in range(1,5)]+[str(e[1])] f[2],f[3]=f[3],f[2] g=[str(d[int(i)])for i in m] g[2],g[3]=g[3],g[2] g+=g for i in range(4): if g[g.index(f[i])+1]!=f[i+1]:print('No');break elif i==3:print('Yes')
s680972996
p02385
u150984829
1513329597
Python
Python3
py
Runtime Error
0
0
338
d,e=[list(map(int,input().split()))for _ in range(2)] m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])] f=[str(e[i])for i in range(1,5)]+[str(e[1])] f[2],f[3]=f[3],f[2]2 g=[str(d[int(i)])for i in m] g[2],g[3]=g[3],g[2] g+=g for i in range(4): if g[g.index(f[i])+1]!=f[i+1]:print('No');break elif i==3:print('Yes')