304648: CF887C. Solution for Cube
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Solution for Cube
题意翻译
给一个二阶魔方的 6 个面 24 块的颜色,现在你要转动魔方一次,问转动后,魔方是否复原完成?题目描述
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2. It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation of one face of the cube in any direction. To check her answers she wants to use a program which will for some state of cube tell if it's possible to solve it using one rotation, described above. Cube is called solved if for each face of cube all squares on it has the same color. <a>https://en.wikipedia.org/wiki/Rubik's\_Cube</a>输入输出格式
输入格式
In first line given a sequence of 24 integers $ a_{i} $ ( $ 1<=a_{i}<=6 $ ), where $ a_{i} $ denotes color of $ i $ -th square. There are exactly 4 occurrences of all colors in this sequence.
输出格式
Print «YES» (without quotes) if it's possible to solve cube using one rotation and «NO» (without quotes) otherwise.
输入输出样例
输入样例 #1
2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4
输出样例 #1
NO
输入样例 #2
5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3
输出样例 #2
YES