#K41212. Unique Matrix Rows
Unique Matrix Rows
Unique Matrix Rows
Given a matrix of integers of size (r \times c), your task is to output all unique rows preserving the order of their first appearance.
A row is considered unique if it has not appeared earlier in the matrix. For example, consider the following matrix:
1 0 0
0 1 1
1 0 0
The unique rows are:
1 0 0
0 1 1
Your program should read the matrix from standard input and print the unique rows to standard output.
inputFormat
The first line contains two integers (r) and (c) which denote the number of rows and columns respectively. This is followed by (r) lines, each containing (c) space-separated integers representing the matrix rows.
outputFormat
Output the unique rows in the order they appear. Each row is printed on a new line with its elements separated by a single space.## sample
3 3
1 0 0
0 1 1
1 0 0
1 0 0
0 1 1
</p>