Please anyone help me with this 98A - Help Victoria the Wise . I do not understand how the solution of editorial is approached.
Please anyone help me with this 98A - Help Victoria the Wise . I do not understand how the solution of editorial is approached.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 3 | Proof_by_QED | 147 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 142 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
| Name |
|---|



:(
Someone will come to help you, even if they don't, you know bro, LIFE_GOES_ON
Writing editorial is difficult for me too.
Link to AC submission
Take a cube and label it as follows.
Up, down : 0, 1
Front, Back : 2, 3
Left, Right : 4, 5
Now, we have 3 different kinds of rotations, each rotation has one of the above pairs fixed and the remaining ones complete some circles.
Say we have {1, 2, 3, 4} as an array. Then one rotation gives {2, 3, 4, 1}. Similarly, the positions for rotation as per the above notation are {0, 2, 1, 3}, {0, 4, 1, 5}, {2, 4, 3, 5}.
It is obvious that only 3 rotations are possible and 4th rotation gives us the original array.
So here's what I did :
Sort the initial string
Go through its permutations
Rotate each of its permutations along each of the 3 axes up to a maximum of 3 times(64 in total)
See if at least one of them already exists in the set
If it doesn't then increase the answer by 1
Push all the rotations of the current permutation into a set