Ranks
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

A finite field F_2 consists of two elements: 0 and 1. Addition and multiplication on F_2 are those on integers modulo two, as defined below.
A set of vectors over F_2 with the same dimension is said to be linearly independent when, for , is equivalent to , where 0 is the zero vector, the vector with all its elements being zero.
The rank of a matrix is the maximum cardinality of its linearly independent sets of column vectors. For example, the rank of the matrix is two; the column vectorsand (the first and the third columns) are linearly independent while the set of all three column vectors is not linearly independent. Note that the rank is zero for the zero matrix.
Given the above definition of the rank of matrices, the following may be an intriguing question. How does a modification of an entry in a matrix change the rank of the matrix? To investigate this question, let us suppose that we are given a matrix A over F_2. For any indices i and j, let be a matrix equivalent to A except that the (i,j) entry is flipped.

In this problem, we are interested in the rank of the matrix . Let us denote the rank of A by r, and that of by . Your task is to determine, for all (i,j) entries, the relation of ranks before and after flipping the entry out of the following possibilities: (i) , (ii) , or (iii) .

输入描述:

The input consists of a single test case of the following format.
n m

. . .
n and m are the numbers of rows and columns in the matrix A, respectively . In the next n lines, the entries of A are listed without spaces in between. is the entry in the i-th row and j-th column, which is either 0 or 1.


输出描述:

Output n lines, each consisting of m characters. The character in the i-th line at the j-th position must be either - (minus), 0 (zero), or + (plus). They correspond to the possibilities (i), (ii), and (iii) in the problem statement respectively.
示例1

输入

复制
2 3 
001 
101

输出

复制
-0-
-00
示例2

输入

复制
5 4
1111
1000
1000
1000
1000

输出

复制
0000
0+++
0+++
0+++
0+++
示例3

输入

复制
10 10
1000001001
0000010100
0000100010
0001000001
0010000010
0100000100
1000001000
0000010000
0000100000
0001000001

输出

复制
000-00000-
0-00000-00
00-00000-0
+00000+000
00-0000000
0-00000000
000-00000-
0-000-0-00
00-0-000-0
+00000+000
示例4

输入

复制
1 1 
0

输出

复制
+