A Special Property
Time Limit : 1 Second
Memory Limit : 512 MB
Submission: 63
Solved: 28
- Description
Given a boolean matrix, which means every element of it is either 0 or 1. If each row and each column of it has an even sum, we call it a magic matrix.
For example:
1 0 1 0
0 0 0 0
1 1 1 1
0 1 0 1
is a magic matrix.
If one magic is not a matrix, we want to know whether we can change only one bit to transform it into a magic matrix, or it should be treated as corrupt.
- Input
The input file will contain more than one test cases.
The first line of each test case contains one integer n(n<100), which represents the size of the matrix.
The following n lines represents a boolean matrix.
- Output
For each input, print one line.
Print "OK" if the given matrix is a magic matrix.
Print "Chang bit (i,j)" if change bit (i, j) can make it a magic matrix.
Print "Corrupt" if the given matrix is not OK and cannot be transform into a magic matrix with one bit changed.
- sample input
-
4 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 4 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 4 1 0 1 0 0 0 1 0 1 1 1 1 0 1 0 1 0
- sample output
-
OK Corrupt Change bit (2,3)
- hint
- source