CubeAnts
SRM 507 · 2010-11-01 · by ir5
Problem Statement
NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.
Fox Ciel is observing the behavior of ants. She has a cube whose vertices are indexed from 0 to 7 as follows.

You are given a
Ciel observes the ants until they all move to the 0-th vertex. In order to determine how clever they were, she wants to know the minimal number of turns that were required for this to happen. Return this minimal number.
Constraints
- pos will contain between 1 and 50 elements, inclusive.
- Each element of pos will be between 0 and 7, inclusive.
{0,1,1}
Returns: 1
{5,4}
Returns: 2
{0}
Returns: 0
There is only one ant, and it is already on the 0-th vertex, so the minimum number of turns required is 0.
{6,1,6}
Returns: 3
{7,7,3,3,7,7,3,3}
Returns: 2
Submissions are judged against all 89 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class CubeAnts with a public method int getMinimumSteps(vector<int> pos) · 89 test cases · 2 s / 256 MB per case