#P10873. [COTS 2022] 帽子 Šeširi
[COTS 2022] 帽子 Šeširi
Background
Translated from Izborne Pripreme 2022 (Croatian IOI/CEOI Team Selection) D1T3. .
I like Xiao Yuan!
Problem Description
OIers are wearing either red or white hats. Each person can only see the colors of the other people's hats, and they will guess the color of their own hat based on what they see.
They want to design a set of guessing strategies that satisfies the following conditions:
- Suppose people wear white hats; then at least of them guess their own hat color correctly.
- Suppose people wear red hats; then at least of them guess their own hat color correctly.
Help them find a strategy such that the conditions are satisfied in all possible cases.
Input Format
One line with one integer .
Output Format
Output lines. Each line is a string of length consisting of .
The string on line describes the strategy of the -th OIer. Specifically:
- Define as follows: sort all strings of length consisting of in lexicographical order, then is the rank of .
- Let be the string output on line , and let be the hat color worn by the -th OIer. Here, means white (Croatian: “bijela”), and means red (Croatian: “crvena”).
- Let $y=\overline{s_1s_{2}\cdots s_{i-1}s_{i+1}\cdots s_n}$. Note that the left side is the most significant bit.
- The color guessed by the -th OIer is .
See [Sample Explanation].
2
BC
CC
3
BBCC
BCBC
BBCC
Hint
Sample Explanation
Take sample as an example.
When , for the -st OIer, and . Clearly , so he will guess .
Scoring
| Test point ID | Score | |
|---|---|---|
Translated by ChatGPT 5