Hubspot Amulet Hubspot Amulet
Simple+
English

While exploring the island, Sofia found an interesting Amulet. Along the perimeter of the amulet small points are marked on each degree (for a total 360 degrees.) Three levers extrude from the amulet with varying lengths. The first lever is the shortest, the second lever is in the middle of the three and the last is the longest. These levers can be rotated, but if you rotate one lever the others rotate as well. The levers rotate discretely by degrees, rotating them clockwise gives you a positive angle while counterclockwise is negative.

After some experiments Sophie discovers the levers correlation. If you rotate a lever, the other rotates in the same direction but with different speed.
If you rotate the first, then the second is rotated f 2 times faster, the third -- at the f 3 time faster.
If you rotate the second, then the third is rotated s 3 times faster, the first -- at the s 1 time faster.
If you rotate the third, then the first is rotated t 1 times faster, the second -- at the t 2 time faster.
This correlation can be represented as a matrix 3x3 with 1 in the main diagonal.
1 f 2 f 3
s 1 1 s 3
t 1 t 2 1
For example, the rotating correlation is given as the matrix:
1 2 3
3 1 2
2 3 1
This means that:
If you rotate the first, the second is rotated at double the angle while the third rotates at triple.
If you rotate the second, the third is rotated at double the angle, and the first rotates at triple.
If you rotate the third, the first is rotated at double the angle, and the second rotates at triple.
For example: You rotate the first lever at +10 degrees. As a result, the second is rotated at +20 degrees and the third at +30 degrees.

You can rotate the levers from -180 to +180 degrees only (but in interrelated mode it can be rotated more than 360 degrees). You can rotate each lever once in the following order: the first, the second, the third. Sophie used her X-ray vision and found out what position each lever should be in. After completing these rotations, the levers must be at 0, 225, 315 .

You are given a rotation matrix as a list of lists with positive integers and the unitary main diagonal. You should return a list of three integers -- the angles for each lever. The start position of the levers is [0, 0, 0].

amulet amulet

Input: A rotation matrix as a list of lists.

Output: The angles as a list of integers.

Example:

checkio([
    [1, 2, 3],
    [3, 1, 2],
    [2, 3, 1]])
checkio([
    [1, 4, 2],
    [2, 1, 2],
    [2, 2, 1]])
    

How it is used: This a funny combinatorial problem that could help you on dangerous journey in remote jungle for an ancient treasure, as we all know, ancient civilizations hide their treasure with tricky puzzles! ;-)

Precondition: ∀ x ∈ matrix : 0 < x < 10
|matrix| = 3x3

Settings
Code:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission Back to the list of missions Back to the map