<PREV Problem:
NEXT>
Solved by 35 users: maa, PetrovSergey, dan, markr, DD, ich, tomek, mikleb, EA, andyzh1314, Rizvanov, RAVEman, blackmath, akuegel, wInuX, WsemirZ, tourist, zloy_mipt, mazahaka, pmnox, jimm88, checkil, defrager, UdH-WiNGeR, avg79, Al.Cash, abortmozga.ru, Dest, Kuznetsov_S, ripatti, Oleg42, oleg.dudrov, Austeritas, mathematic, murphy.
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Rubik's Cube 2 × 2 × 2

Time limit = 5

Cube 2 × 2 × 2 development :

   1  2
   3  4
   ----
17 18 | 5  6 | 21 22
19 20 | 7  8 | 23 24
   ----
   9  10
   11  12
   ----
   13  14
   15  16

Input One line with 24 colors numbers. i-th number corresponds to the color of the i-th cell.

Output Minimal number of 90°-rotations needed to come to state with one-colour (monochromatic) sides .

Input#1
1 1 5 5 2 2 2 2 4 4 6 6 3 3 3 3 5 6 5 6 1 4 1 4
Output#1
1
Input#2
2 1 2 3 1 2 3 2 4 1 4 3 1 4 3 4 6 6 5 5 5 6 5 6
Output#2
3


Author:
Kvasov Igor
20 May 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 54.161.108.158