logo AlgoBeat OnlineJudge
登录 注册

#215018. [ICPC 2018 Yokohama R] Ranks

内存限制:512 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A finite field consists of two elements: and . Addition and multiplication on are those on integers modulo two, as defined below.

A set of vectors over with the same dimension is said to be linearly independent when, for , is equivalent to , where 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 vectors and (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 over . For any indices and , let be a matrix equivalent to except that the entry is flipped.

In this problem, we are interested in the rank of the matrix . Let us denote the rank of by , and that of by . Your task is to determine, for all 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.

and are the numbers of rows and columns in the matrix , respectively (, ). In the next lines, the entries of are listed without spaces in between. is the entry in the -th row and -th column, which is either or .

输出格式

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

样例

样例输入 1

2 3
001
101

样例输出 1

-0-
-00

样例输入 2

5 4
1111
1000
1000
1000
1000

样例输出 2

0000
0+++
0+++
0+++
0+++

样例输入 3

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

样例输出 3

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

样例输出 4

+