Maths Olympiad Prep

Library / /20 of 20

Combinatorics Difficulty 7.8 National olympiad, round 2 Prove it North Macedonia

In a city of gnomes there are 10001000 identical towers, each of which has 10001000 stories, with exactly one gnome living on each story. Every citizen proudly wears a hat colored in one of 10001000 possible colors and any two residents of the same tower wear differently colored hats. A pair of gnomes are friends if they wear hats of the same color, one of them lives on the kk-th story of his tower and the other one lives on the (k+1)(k+1)-st story of his tower. Determine the maximum possible number of pairs of gnomes that are friends.

Solution

Let us analyze the problem. There are 10001000 towers, each with 10001000 stories, so there are 1000×1000=1061000 \times 1000 = 10^6 gnomes. Each gnome wears a hat of one of 10001000 colors, and in each tower, all 10001000 colors are present (since any two residents of the same tower wear differently colored hats).

A pair of gnomes are friends if:
- They wear hats of the same color.
- One lives on the kk-th story of his tower, and the other on the (k+1)(k+1)-st story of his tower (possibly in a different tower).

We are to maximize the number of such pairs.

Let us fix a color cc. In each tower, there is exactly one gnome with hat color cc on each story. So, for color cc, there are 10001000 towers ×\times 10001000 stories = 10001000 gnomes with color cc.

For each color cc, consider the gnomes on the kk-th story in all towers. There are 10001000 such gnomes (one per tower). Similarly, for the (k+1)(k+1)-st story. For each k=1k = 1 to 999999, we can pair each gnome on the kk-th story with each gnome on the (k+1)(k+1)-st story, but only if they are in different towers (since in the same tower, the two gnomes have different colors).

But the definition says: "one of them lives on the kk-th story of his tower and the other one lives on the (k+1)(k+1)-st story of his tower". It does not require them to be in the same tower, and in fact, in the same tower, the two gnomes have different colors, so cannot be friends.

So, for each color cc, for each k=1k = 1 to 999999, we can pair the gnome with color cc on the kk-th story of tower ii with the gnome with color cc on the (k+1)(k+1)-st story of tower jj, for all i,ji, j from 11 to 10001000.

But to count the number of pairs, for each color cc, for each k=1k = 1 to 999999, there are 10001000 gnomes on the kk-th story and 10001000 gnomes on the (k+1)(k+1)-st story, so 1000×1000=1061000 \times 1000 = 10^6 possible pairs for each kk and each color cc.

But we must be careful: is it allowed to pair a gnome on the kk-th story of tower ii with the gnome on the (k+1)(k+1)-st story of tower jj for any i,ji, j? Yes, as long as they have the same color, which is possible since every tower has all colors, and the gnome on the kk-th story of tower ii with color cc exists for every ii and kk.

But the problem asks for the maximum possible number of pairs. That is, we can assign the colors to the gnomes in the towers in any way, as long as in each tower, all 10001000 colors are present (no two gnomes in the same tower have the same color).

Let us try to maximize the number of pairs. For each color cc, for each k=1k = 1 to 999999, the gnome with color cc on the kk-th story of tower ii and the gnome with color cc on the (k+1)(k+1)-st story of tower jj can be paired as friends for all i,ji, j.

But the problem says "a pair of gnomes are friends if they wear hats of the same color, one of them lives on the kk-th story of his tower and the other one lives on the (k+1)(k+1)-st story of his tower". It does not specify that the towers must be different, but in the same tower, the two gnomes have different colors, so cannot be friends.

Therefore, for each color cc, for each k=1k = 1 to 999999, the gnome with color cc on the kk-th story of tower ii and the gnome with color cc on the (k+1)(k+1)-st story of tower jj are friends for all i,ji, j from 11 to 10001000.

But we must count the number of pairs. For each color cc, for each k=1k = 1 to 999999, there are 10001000 gnomes on the kk-th story and 10001000 gnomes on the (k+1)(k+1)-st story, so 1000×1000=1061000 \times 1000 = 10^6 pairs for each kk and each color cc.

But if we count all such pairs, we are counting each unordered pair twice (once as (a,b)(a,b) and once as (b,a)(b,a)), unless the problem wants ordered pairs. But the problem says "a pair of gnomes are friends if...", so we count unordered pairs.

But in this construction, for each color cc, for each k=1k = 1 to 999999, for each i,ji, j from 11 to 10001000, the pair (gnome with color cc on kk-th story of tower ii, gnome with color cc on (k+1)(k+1)-st story of tower jj) is a friend pair. But the pair (gnome on kk-th story of tower ii, gnome on (k+1)(k+1)-st story of tower jj) and (gnome on (k+1)(k+1)-st story of tower jj, gnome on kk-th story of tower ii) are different unless i=ji = j and kk and k+1k+1 are swapped, but since in the same tower, the two gnomes have different colors, so cannot be friends.

Therefore, for each color cc, for each k=1k = 1 to 999999, for each iji \neq j, the pair (gnome with color cc on kk-th story of tower ii, gnome with color cc on (k+1)(k+1)-st story of tower jj) is a friend pair.

But the problem does not specify that the two gnomes must be in different towers, but in the same tower, the two gnomes have different colors, so cannot be friends.

Therefore, for each color cc, for each k=1k = 1 to 999999, for each i,ji, j from 11 to 10001000, iji \neq j, the pair (gnome with color cc on kk-th story of tower ii, gnome with color cc on (k+1)(k+1)-st story of tower jj) is a friend pair.

But since the gnome with color cc on kk-th story of tower ii and the gnome with color cc on (k+1)(k+1)-st story of tower jj are distinct for iji \neq j, and the pair is unordered, we must count each pair only once.

Alternatively, for each color cc, for each k=1k = 1 to 999999, there are 10001000 gnomes on the kk-th story and 10001000 gnomes on the (k+1)(k+1)-st story, so 1000×1000=1061000 \times 1000 = 10^6 pairs for each kk and each color cc.

But since the gnomes are in different towers, and the colors are assigned so that in each tower, all colors are present, the maximum possible number of pairs is achieved when for each color cc, for each k=1k = 1 to 999999, all 10001000 gnomes on the kk-th story and all 10001000 gnomes on the (k+1)(k+1)-st story are paired.

Therefore, the total number of pairs is:

Number of colors: 10001000
Number of kk: 999999 (from 11 to 999999)
For each kk and color, 1000×1000=1061000 \times 1000 = 10^6 pairs

Total number of pairs:
1000×999×106=999×109 1000 \times 999 \times 10^6 = 999 \times 10^9

Therefore, the maximum possible number of pairs of gnomes that are friends is 999×109999 \times 10^9.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic and difficulty added by this site.