Given three numbers a, b and c.
You have to output the minimum number of steps in the worst case required by a strategy, that can determine the state (honest, dishonest, random) of a group of a+b+c men, provided that a of those are honest, b of those are dishonest, and c of those are random. Every one of those people knows the state of every other.
A strategy can be represented by a deterministic function
([list of (past questions, past answer)]) -> ((next person to ask, question to ask) | (resulting state))
where
(question to ask) is a function (states) -> (answer: bool)
When a strategy is applied to a set of person, the following procedure is repeatedly applied:
* Evaluate the function with the current list of past questions/answers
* If the result is the resulting state, finish (and compute the number of questions asked)
* Otherwise, ask the person indicated by the function result.
* The answer received is:
+ Equal to ((the question asked) applied on the state) if the person asked is honest
+ Not equal to ((the question asked) applied on the state) if the person asked is dishonest
+ May be true or false if the person asked is random
A strategy is considered correct and have the worst case number of steps <= X if everyone's states are always determined correctly in <= X steps, regardless of the answers received.
You can assumes that the input values (a, b, c) are such that there exists a correct strategy.