#B2100. Chessboard Influence
Chessboard Influence
Chessboard Influence
You are given three natural numbers \(N\), \(i\) and \(j\) (with \(1 \le i \le N\) and \(1 \le j \le N\)). Imagine an \(N \times N\) chessboard with rows and columns numbered starting from 1. Your task is to output all the positions on the board that share the same row, the same column, the main diagonal, or the anti-diagonal with the cell located at \((i, j)\).
Details:
- Row: All cells in row \(i\).
- Column: All cells in column \(j\).
- Main Diagonal: All cells \((r, c)\) that satisfy \(r - c = i - j\). The order should be from the upper left to the lower right.
- Anti-Diagonal: All cells \((r, c)\) that satisfy \(r + c = i + j\). The output order should be from the bottom left to the top right.
Each set of positions should be printed on a separate line and the positions are formatted as \((r, c)\) without any spaces in between adjacent positions.
Example:
Input: 4 2 3</p>Output: (2,1)(2,2)(2,3)(2,4) (1,3)(2,3)(3,3)(4,3) (1,2)(2,3)(3,4) (4,1)(3,2)(2,3)(1,4)
inputFormat
The input consists of a single line containing three natural numbers \(N\), \(i\), and \(j\) (separated by spaces), where \(N\) represents the size of the chessboard and \(i\), \(j\) indicate the position of the cell.
\(1 \le i, j \le N\)
outputFormat
Print four lines:
- The first line contains the positions from the same row as \((i, j)\).
- The second line contains the positions from the same column as \((i, j)\).
- The third line contains the positions on the main diagonal (\(r - c = i - j\)) from top-left to bottom-right.
- The fourth line contains the positions on the anti-diagonal (\(r + c = i + j\)) from bottom-left to top-right.
Each position is formatted as \((r, c)\) and positions in a line are concatenated without spaces.
sample
4 2 3
(2,1)(2,2)(2,3)(2,4)
(1,3)(2,3)(3,3)(4,3)
(1,2)(2,3)(3,4)
(4,1)(3,2)(2,3)(1,4)
</p>