Editorial for IOI '10 P1 - Cluedo

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

This was intended to be a very easy task. The number of features to be determined (murderer, location, weapon), and the number of options for each feature were intentionally fixed, and not parameterized.

Given that there are 6 candidate murderers, 10 candidate locations, and 6 candidate weapons, there is a total of 6 \times 10 \times 6 = 360 theories.

Subtask 1 could be solved by trying each possible theory (three nested for loops).

Because the response to a refuted theory will identify one feature for which a wrong option was guessed, the search can be expedited. All theories having that wrong option for that particular feature are now ruled out.

Subtask 2 can be solved by a single loop, incrementing whichever feature was wrong (a monotonic search). The total number of options equals 6+10+6 = 22, and the last option not ruled out must be correct (it was given that there is exactly one correct theory). Therefore, at most 22-3 = 19 refuted calls to Theory are needed. One confirming call to Theory was required, so a total of 20 calls suffices.


There are no comments at the moment.