Codeforces Round 140 (Div. 1)
D
The table
Codeforces
2100
原题
← CE →
翻译中…

Harry Potter has a difficult homework. Given a rectangular table, consisting of $*n* × *m*$ cells. Each cell of the table contains the integer. Harry knows how to use two spells: the first spell change the sign of the integers in the selected row, the second — in the selected column. Harry's task is to make non-negative the sum of the numbers in each row and each column using these spells.

翻译中…

Alone, the boy can not cope. Help the young magician!

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*m*$ $(1 ≤ *n*,  *m* ≤ 100)$ — the number of rows and the number of columns.

翻译中…

Next $*n*$ lines follow, each contains $*m*$ integers: $*j*$-th integer in the $*i*$-th line is $*a*_{*i*, *j*}$ $(|*a*_{*i*, *j*}| ≤ 100)$, the number in the $*i*$-th row and $*j*$-th column of the table.

翻译中…

The rows of the table numbered from 1 to $*n*$. The columns of the table numbered from 1 to $*m*$.

翻译中…

Output

翻译中…

In the first line print the number $*a*$ — the number of required applications of the first spell. Next print $*a*$ space-separated integers — the row numbers, you want to apply a spell. These row numbers must be distinct!

翻译中…

In the second line print the number $*b*$ — the number of required applications of the second spell. Next print $*b*$ space-separated integers — the column numbers, you want to apply a spell. These column numbers must be distinct!

翻译中…

If there are several solutions are allowed to print any of them.

翻译中…

样例

Input #1
4 1
-1
-1
-1
-1
Output #1
4 1 2 3 4
0
InputCopy OutputCopy
Input #2
2 4
-1 -1 -1 2
1 1 1 1
Output #2
1 1
1 4
InputCopy OutputCopy
题目信息
题号
226D
时间限制
2 s
内存限制
256 MB
标签
构造
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。