A higher resolution is required to access the IDE
- 126
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Futoshiki is a Japanese numeric logic puzzle similar to the more popular Sudoku.See https://en.wikipedia.org/wiki/Futoshiki
Like in Sudoku, in a Futoshiki of size n every row and every column must contain every number from 1 to n.
Unlike Sudoku there may be greater than / less than relations between cells.
For a n×n Futoshiki the input will be 2n-1 lines of digits
Example: A 2×2 Futoshiki
0>0having the solution:
v ^
0<0
21
12
Input
Line 1: number size of lines to read
Next size lines:
- even-numbered lines: string of length size alternating between a number0..n and a space or < or > .
- odd-numbered lines: string of length size containing spaces andv or ^ on even-numbered positions and spaces on odd-numbered positions.
Next size lines:
- even-numbered lines: string of length size alternating between a number
- odd-numbered lines: string of length size containing spaces and
Output
n lines: n digits for each row of the solved board
(for n such that size = 2×n - 1)
(for n such that size = 2×n - 1)
Constraints
There is only 1 correct solution to each board.
1 ≤ size ≤ 13
1 ≤ size ≤ 13
Example
Input
3 1 0 0 0
Output
12 21
A higher resolution is required to access the IDE