#4539. 3^N Minesweeper
3^N Minesweeper
3^N Minesweeper
题目描述
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.
输入格式
The input is given from Standard Input in the following format:
输出格式
Print with spaces in between, where if position has no bomb and if position has a bomb.
1
0 1 1
0 0 1
2
2 3 2 4 5 3 3 4 2
0 1 0 1 0 1 1 1 0
2
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
提示
There is a placement of bombs consistent with .
All values in the input are integers.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.
标签: AtCoder|abc288G
来源
AtCoder|abc288G