[READ-ONLY] Mirror of https://github.com/shuuji3/competitive-programming. 馃洬 Codes submitted to competitive programming platforms
aizu-online-jadge aoj atcoder hackerrank leetcode
0

Configure Feed

Select the types of activity you want to include in your feed.

1class Dice: 2 def __init__(self, top: str, front: str, right: str, left: str, back: str, bottom: str) -> None: 3 self.top = top 4 self.front = front 5 self.right = right 6 self.left = left 7 self.back = back 8 self.bottom = bottom 9 10 def __eq__(self, other) -> bool: 11 for directions in ['', 'N', 'SE', 'WW', 'ES', 'S']: 12 for direction in directions: 13 other.roll(direction) 14 15 for _ in range(4): 16 other.rotate_right() 17 if ( 18 self.top == other.top 19 and self.front == other.front 20 and self.back == other.back 21 and self.right == other.right 22 and self.left == other.left 23 and self.bottom == other.bottom 24 ): 25 return True 26 return False 27 28 def print_top(self): 29 print(self.top) 30 31 def print_right(self): 32 print(self.right) 33 34 def roll(self, direction: str) -> None: 35 if direction == 'S': 36 self.south() 37 elif direction == 'N': 38 self.north() 39 elif direction == 'E': 40 self.east() 41 elif direction == 'W': 42 self.west() 43 44 def north(self): 45 [self.top, self.back, self.bottom, self.front] = [self.front, self.top, self.back, self.bottom] 46 47 def south(self): 48 [self.top, self.back, self.bottom, self.front] = [self.back, self.bottom, self.front, self.top] 49 50 def east(self): 51 [self.top, self.right, self.bottom, self.left] = [self.left, self.top, self.right, self.bottom] 52 53 def west(self): 54 [self.top, self.right, self.bottom, self.left] = [self.right, self.bottom, self.left, self.top] 55 56 def rotate_right(self) -> None: 57 for direction in 'SWN': 58 self.roll(direction) 59 60 61n = int(input()) 62dices = [] 63for _ in range(n): 64 dices.append(Dice(*input().split())) 65 66dice1 = dices[0] 67all_different = all(map(lambda dice: dice != dice1, dices[1:])) 68if all_different: 69 print('Yes') 70else: 71 print('No')