#C5995. Matrix Equality Checker

    ID: 49705 Type: Default 1000ms 256MiB

Matrix Equality Checker

Matrix Equality Checker

Given two matrices, determine if they are equal. Two matrices \(A\) and \(B\) are considered equal if they have the same dimensions and every corresponding element satisfies \(A[i][j] = B[i][j]\).

The input comprises two matrices. Your task is to check whether the matrices are equal and output Equal if they are, or Not equal otherwise.

Note: The matrices may be empty. Use the standard input and output.

inputFormat

The input is read from standard input (stdin) in the following format:

→ The first line contains two integers, \(r_1\) and \(c_1\), representing the number of rows and columns of the first matrix.
→ The next \(r_1\) lines each contain \(c_1\) space-separated integers representing the elements of the first matrix.
→ The following line contains two integers, \(r_2\) and \(c_2\), representing the number of rows and columns of the second matrix.
→ The next \(r_2\) lines each contain \(c_2\) space-separated integers representing the elements of the second matrix.

Both matrices are provided consecutively.

outputFormat

Output a single line to the standard output (stdout):

  • Equal if the two matrices are the same.
  • Not equal otherwise.
## sample
2 3
1 2 3
4 5 6
2 3
1 2 3
4 5 6
Equal