Find two coins of weight a, among n coins, where n-2 coins are coins of weight b

116 Views Asked by At

Task: Among the n coins there are exactly 2 coins of weight a, and exactly $n − 2$ coins of weight $b, a < b$. It is allowed to compare the weight of any two coins in one turn (there are three comparison results: lighter, heavier, of the same weight). Purpose: to determine the weight of each coin. Prove that there is such a constant $C$ that at least $\frac{2n}{3} − C$ comparisons are necessary.

Some thinkings: Not sure where to begin. As far as I understand, in this task it is necessary to prove that in less than $\frac{2n}{3}$ comparisons it is impossible to determine the weight of each coin.

UPD: In the comments, people left really good advice on solving this task, but it is unclear how to link this to the constant C. It is clear that at best it is possible to determine the weight of all coins in 2 comparisons, and in $\frac{2n}{3}$ comparisons in the worst case. But how exactly to relate this to the constant C is not entirely clear to me

1

There are 1 best solutions below

0
On BEST ANSWER

Sudeep has given a nice hint in the comments. First observe that for $n=3$, you require 2 moves in the worst case, so $C\le 0$. By "determine" I mean deduce the type of coin.

Next, note that we can divide the $n$ coins into $n/3$ parts or $\lfloor n/3\rfloor+1$ parts depending on $n \text{ mod } 3$. In the second case, the last part contains one or two coins, while all other parts contain three coins. It takes two moves to completely determine a triplet of coins (can you see why?).

So, for $n=3k$, you require $2n/3$ moves, for $n=3k+1$, the last part has length $1$ and is completely determined by the results of the previous part, so you only need to determine the first $k$ parts. For $n = 3k+2$, you need to determine all the $k+1$ parts, but for the last part, you only need one move. Note that $\lfloor 2n/3 \rfloor = 2k+1$, so we're good.