Daily

Random

Practice set

Baltic Way 2023 · Problem 7

Combinatorics

A robot moves in the plane in a straight line, but every one meter it turns 90∘90^{\circ} to the right or to the left. At some point it reaches its starting point without having visited any other point more than once, and stops immediately. What are the possible path lengths of the robot?

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Colorings and configurations · Pigeonhole and extremal arguments · Invariants and monovariants

Solutions

Solution

Let us define the coordinates system with unit length of one meter, point of origin in the starting point and vertical-horizontal axes. W.l.o.g. assume that the first move was east and the path had length of nn. Then each odd move changed xx coordinate of the robot by 1 and each even move changed yy coordinate by 1 .

At the end of the day both coordinates were equal to zero again, so there had to be even number of odd and even number of even moves. That implies that only nn divisible by 4 can fulfill the conditions.

For n=4n=4 we have a square path. For n=8n=8 we had 4 changes of xx coordinate and 4 changes of yy, so the whole path was inside some 2×22 \times 2 square. Unfortunately that's not possible without reaching some point twice.

Now, we will prove that all n>8n>8 divisible by 4 are good. For n=12n=12 there is a path in shape of "+" with first 4 moves like (→,↑,→,↑)(\rightarrow, \uparrow, \rightarrow, \uparrow). Now we can change the middle (↑,→)(\uparrow, \rightarrow) sequence by (↓,→,↑,→,↑,←)(\downarrow, \rightarrow, \uparrow, \rightarrow, \uparrow, \leftarrow). Thanks to this change the robot explored new territory south-east from the one before explored. We got +4 of length of the path. There we can do it again and again, reaching any length of 4k+84 k+8 for all k∈Z+k \in \mathbb{Z}^{+}.

Contest context

Results from Baltic Way 2023

10 teams

Mean score
4.7 / 5
Scores of 4 or 5
9 / 10
Estonia
5 / 5

Score distribution

00
10
21
30
40
59
All team scores
TeamScore
Germany5 / 5
Sweden5 / 5
Lithuania5 / 5
Poland2 / 5
Estonia5 / 5
Latvia5 / 5
Norway5 / 5
Denmark5 / 5
Finland5 / 5
Iceland5 / 5