#K83482. Alien Matrix Construction

    ID: 36207 Type: Default 1000ms 256MiB

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:

  1. An integer \(N\) representing the size of the matrix.
  2. \(N\) space-separated integers representing the first row of the matrix.
  3. \(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.

## sample
3
1 2 3
1 4 7
1 2 3

4 1 2 7 4 1

</p>