Editorial for IOI '15 P2 - Scales
Submitting an official solution before solving the problem yourself is a bannable offence.
This is based on the well-known problem of ordering five coins with
In our problem, there are
The easiest solution here is to generate a memorization function which, for each possible subset of possible permutations, tries all the possible questions, and returns the best one. It is possible to bound the branching, as follows:
- Always take care that there are at most
consistent results after weighing, at most consistent results after weighings, etc. - If, for the given subset of power
, we have already found a solution which uses weighings, and , then do not look further (we have already found the best possible answer).
With these optimizations, we could write a program which generates the strategy tree, in the form of a program which could be submitted for judging. With the optimizations above, it is also possible to generate it on the fly.
Comments