Daily

Random

Practice set

Baltic Way 2023 · Problem 6

Combinatorics

Let nn be a positive integer. Each cell of an n×nn \times n table is coloured in one of kk colours where every colour is used at least once. Two different colours AA and BB are said to touch each other, if there exists a cell coloured in AA sharing a side with a cell coloured in BB. The table is coloured in such a way that each colour touches at most 2 other colours. What is the maximal value of kk in terms of nn ?

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Colorings and configurations · Pigeonhole and extremal arguments · Graph theory

Solutions

Solution

k=2n−1k = 2n-1 when n≠2n \neq 2 and k=4k = 4 when n=2n = 2. k=2n−1k = 2n - 1 is possible by colouring diagonally as shown in the figure below and when n=2n = 2, k=4k = 4 is possible by colouring each cell in a unique colour. Diagram for the mathnet 01ip 1 of bw-2023-06.

We consider the graph, where each node represents a colour and two nodes are linked, if the colours they represent touch. This graph is connected and since each colour touches at most 2 colours every node has at most degree 2. This means that the graph is either one long chain or one big cycle. Diagram for the mathnet 01ip 1 of bw-2023-06.

We now look at the case when nn is odd. Consider the cell in the center of the table. From this cell we can get to any other cell by passing through at most n−1n-1 cells. Therefore from the node representing this cell, we can get to any node through at most n−1n-1 edges. But if the graph has 2n2n or more nodes, then for every node there is a node which is more than n−1n-1 edges away. So we must have k≤2n−1k \le 2n-1 for all odd nn.

When nn is even we consider the 4 center cells. If they all have a different colour, then they form a 4-cycle in the graph, meaning the graph has only 4 nodes. If two of the center cells have the same colour, then from this colour you will be able to get to all other cells passing through at most n−1n-1 cells. By same the arguments as in the odd case, we get k≤max⁡(2n−1,4)k \le \max(2n-1, 4) for even nn.

So overall we have k≤2n−1k \le 2n-1 for n≠2n \ne 2 and k≤4k \le 4 for n=2n = 2 as desired.

Contest context

Results from Baltic Way 2023

10 teams

Mean score
2.4 / 5
Scores of 4 or 5
3 / 10
Estonia
4 / 5

Score distribution

01
11
25
30
42
51
All team scores
TeamScore
Germany5 / 5
Sweden2 / 5
Lithuania4 / 5
Poland2 / 5
Estonia4 / 5
Latvia2 / 5
Norway2 / 5
Denmark0 / 5
Finland1 / 5
Iceland2 / 5