RithwikG's picture
initial commit
7a8878c
You are given an undirected connected graph, some vertices of which contain tokens and/or bonuses. Consider a game involving one player  — you.You can move tokens according to the following rules: At the beginning of the game, you can make exactly one turn: move any token to any adjacent vertex. If the movement of the token ended on the bonus, then you are allowed to make another turn with any other token. You can use different bonuses in any order. The same bonus can be used an unlimited number of times. Bonuses do not move during the game.There can be several tokens in one vertex at the same time, but initially there is no more than one token in each vertex.The vertex with number 1 is the finish vertex, and your task is to determine whether it is possible to hit it with any token by making turns with the tiles according to the rules described above. If a token is initially located at the vertex of 1, then the game is considered already won. The finish line is in black, the bonuses are in red, the chips are in grey. For example, for a given graph, you can reach the finish line with a chip from the 8th vertex by making the following sequence of turns: Move from the 8-th vertex to the 6-th. Move from the 7-th vertex to the 5-th. Move from the 6-th vertex to the 4-th. Move from the 5-th vertex to the 6-th. Move from the 4-th vertex to the 2-nd. Move from the 6-th vertex to the 4-th. Move from the 2-nd vertex to the 1-st vertex, which is the finish.