Editorial for IOI '18 P1 - Combo
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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Let be the number of asks.
- Ask all possible strings until is returned.
- Determine the characters of from the beginning one by one.
- For each position, try all four characters one by one.
or
- Determine the characters of from the beginning one by one.
- For the first position, determine the character by three asks. For each position except the first one, considering the constraint of , determine the character by two asks.
- Or for each position, using conditional branches, determine the character by two asks.
- Determine the characters of from the beginning one by one.
- Except for the first or last position, determine the character by one ask as follows.
- Assume that the first character of is, for example,
A
. - Let be the prefix of already known.
- Ask .
- If the next character is
B
, then is returned. If it isX
, then is returned. If it isY
, then is returned.
- Assume that the first character of is, for example,
- Note that if , you can get nearly full points according to .
Comments