409870: GYM103821 B Bored of Board Games

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Bored of Board Gamestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Every weekend you play some board games with your friends. There's one specific game you want to play this weekend, the game consists of a board with $$$N$$$ rows and $$$M$$$ columns, in each cell of the board there is an integer. Initially all integers are hidden. Each player chooses a row or a column, when all players are done choosing the board is revealed, and each player sums the values of the integers in his row or column, then all players with negative sums will lose the game.

The board of the game comes with a switch for each row and each column, and flipping the switch will reverse the sign of each integer of the row or column of that switch.

You realized that next weekend is the birthday of all your friends and you don't want to make anyone sad by losing the game, so you were wondering whether you can use switches on the initial board of the game so that no one will lose the game no matter what row or column they choose?

Input

The first line contains a single integer T ($$$1\le{T}\le 1000 $$$), the number of test cases.

The first line of each test case consists of two integers $$$N$$$ and $$$M$$$($$$1\le{N,M}\le{200}$$$) the number of rows and columns of the board $$$B$$$. Each of the next $$$N$$$ lines will contain $$$M$$$ integers $$$B_{i,j}$$$ ($$$-50 \le {B_{i,j}} \le 50$$$), where $$$B_{i,j}$$$ is the integer in the $$$i_{th}$$$ row and $$$j_{th}$$$ column of the board $$$B$$$.

It is $$$\bf{guaranteed}$$$ that the sum of $$$N \times M$$$ over all test cases does not exceed $$$40\,000$$$.

Output

For each test case, if you can select some rows and columns to flip such that there is a solution then print 'Yes' (without the quotes) in one line, then print in one line $$$R$$$ the number of rows that you want to flip , on the next line print $$$R$$$ ($$$0\le R \le N$$$) numbers, the indices of the rows that you want to flip, on the next line print $$$C$$$ the number of columns that you want to flip, on the next line print $$$C$$$ ($$$0\le C \le M$$$) numbers, the indices of the columns that you want to flip. If no solutions exists then print 'No' (without the quotes) in one line.

The printed rows and columns must be distinct each.

ExampleInput
2
4 4
-3 -7 2 1
0 2 -3 1
2 1 2 2
-2 3 -4 0
3 4
1 2 3 5
-2 -2 5 20
7 5 6 0
Output
Yes
2
1 4 
0

Yes
0

0

加入题单

算法标签: