#K14901. Generate a Symmetric Matrix

    ID: 24237 Type: Default 1000ms 256MiB

Generate a Symmetric Matrix

Generate a Symmetric Matrix

You are given two integers \( m \) and \( d \). Your task is to generate an \( m \times m \) symmetric matrix \( A \) such that:

  • The diagonal elements are equal to \( d \); that is, \( A_{i,i} = d \) for \( 1 \leq i \leq m \).
  • All off-diagonal elements are equal to 1; that is, \( A_{i,j} = 1 \) for \( i \neq j \).

Output the matrix with each row on a separate line, and within each row, print the elements separated by a single space.

Note: The input will be read from stdin and the output should be printed to stdout.

inputFormat

The input consists of a single line containing two space-separated integers:

  1. \( m \) (\(1 \leq m \leq 100\)) – the size of the matrix.
  2. \( d \) (\(|d| \leq 10^9\)) – the value for the diagonal elements of the matrix.

Read the input from stdin.

outputFormat

Output the \( m \times m \) symmetric matrix. Each row should be printed on its own line with the elements separated by a single space. The output should be written to stdout.

## sample
3 5
5 1 1

1 5 1 1 1 5

</p>