#abc288g. G - 3^N Minesweeper
G - 3^N Minesweeper
Score : points
问题描述
在位置 上,可能存在0个或1个炸弹。
我们称位置 和 是 相邻 的,当且仅当对于每个 满足以下条件:
- 让 和 分别表示 和 在三进制表示下的第 低位数,则有 。
已知在与位置 相邻的位置上总共存在恰好 个炸弹。请打印出与该信息一致的炸弹布局。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is zero or one bomb at each of positions .
Let us say that positions and are neighboring each other if and only if the following condition is satisfied for every .
- Let and be the -th lowest digits of and in ternary representation, respectively. Then, .
It is known that there are exactly bombs in total at the positions neighboring position . Print a placement of bombs consistent with this information.
Constraints
- There is a placement of bombs consistent with .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print with spaces in between, where if position has no bomb and if position has a bomb.
Sample Input 1
1
0 1 1
Sample Output 1
0 0 1
Position is neighboring positions and , which have bombs in total.
Position is neighboring positions , , and , which have bomb in total.
Position is neighboring positions and , which have bombs in total.
If there is a bomb at only position , all conditions above are satisfied, so this placement is correct.
Sample Input 2
2
2 3 2 4 5 3 3 4 2
Sample Output 2
0 1 0 1 0 1 1 1 0
Sample Input 3
2
0 0 0 0 0 0 0 0 0
Sample Output 3
0 0 0 0 0 0 0 0 0
update @ 2024/3/10 12:03:00