#K83482. Alien Matrix Construction
Alien Matrix Construction
Alien Matrix Construction
Given an integer N and two arrays of integers representing the first row and the first column of an N \times N matrix, construct the Alien Matrix as follows:
The first row is provided and the first column is provided. For each cell \(M[i][j]\) with \(i, j \gt 0\), the value is equal to the value of the cell diagonally up-left, i.e.,
\[ M[i][j] = M[i-1][j-1] \]
Your task is to compute and print the resulting matrix.
inputFormat
The input consists of three lines:
- An integer \(N\) representing the size of the matrix.
- \(N\) space-separated integers representing the first row of the matrix.
- \(N\) space-separated integers representing the first column of the matrix.
outputFormat
Output the constructed matrix in \(N\) lines. Each line should contain \(N\) space-separated integers corresponding to the matrix row.
## sample3
1 2 3
1 4 7
1 2 3
4 1 2
7 4 1
</p>