P17778 [HackerEarth] Diti's friends are visiting her house for her birthday. The party has N x M members including Diti. Diti's father has organized the party and he wants everyone to return satisfied. A mem
普及
题目描述

Diti's friends are visiting her house for her birthday. The party has N x M members including Diti. Diti's father has organized the party and he wants everyone to return satisfied. A member will be satisfied only if he/she has a piece of chocolate.

Diti's father organized everyone into N rows with each row having M members. Diti's father may initially give chocolates to any number of members. Consider every chocolate to be sufficiently large such that it can be shared with many people. If at any point of time, a person who has a piece of chocolate sees that his neighbour also has a piece of chocolate, he feels sorry for all his other neighbours who don't have a piece of chocolate and shares a part of his chocolate with all of them.

Given the initial distribution of chocolates, report whether everyone will get a piece of chocolate or not, also report the minimum number of chocolates that should be added in the initial configuration such that every child gets at least one piece of it.

Note: Two cells are neighbours if they share a common edge.
Input
The first line contains an integer T, number of test cases. Every test case starts with 2 numbers N and M. The next N lines contain M integers each (without spaces). If the integer on i^th row and j^th column is 1 it means that that member initially has chocolate
whereas 0 means initially the member doesn't have any chocolate.
Output
For every test case output the answer to question in a new line. Output "yes" (without quotes) if the initial distribution results in satisfaction of everyone or "no" (without quotes) if the initial distribution doesn't result in satisfaction of everyone. For each test case also print an additional number after a single space indicating the minimum number of chocolates father needs to initially distribute that will result in satisfaction of everyone.
Constraints
1 ≤ T ≤ 5
1 ≤ N ≤ 10^2
1 ≤ M ≤ 10^2

Author : Sayan
Tester : Ravi

SAMPLE INPUT
1
2 3
111
000

SAMPLE OUTPUT
yes 0

输入格式

见题面

输出格式

见题面

样例输入
5 46 12 010111000010 000001000111 100101001111 111011101110 011010100000 000100011011 111010111011 100011111101 011110111100 010010110100 110101110011 010110101111 010101000000 010101010010 011011101010 110111001001 111111110111 011001101100 000000101111 111011001100 000000100111 110101110000 001001100001 000101000101 010110010111 111111010101 000010011111 000001110000 000100000101 001111101010 101111111110 110011111101 001110011000 001110001101 110100001111 000001110111 100110101100 100100001101 101111011100 101011111110 010010110010 001101000010 010001100110 011111000010 011000000011 011000111011 93 98 10101110100010110011000000011010111001111001110101111110110101010101001110110010000010011011001010 01011100101011010011101101101101001100100101001001011110011101100100110000111111000100010110011110 01010010100111010101101010111011001010011010110111101110111110111000000101000000001110110000001010 11101111111000010000100000000010001001001011000101101101110100101011101010100010000111110100010111 00001011100010000110101111010101111101010111111000101010011010001100100000101101111011101010101101 11111100010011011001111101101011101011010000010111001101011101000000011011010101010001101011011011 00000010110101001111011110101011010111001000111101010101000111010101101010101110000000111111010100 11000011111100011110011101110010001110000111011110001110110010011001000001111111010100100100110101 01110110110111010011111100100000000010100011011000000100101100011111000101011000111100010111010001 00011111111111010000010010101010111001000010100101100001101011101101011011001000110111111010000000 11011000001010110010001000011100010011110011000111011110101001100101101001101101001111011110111100 10010010101111100011010001000111010010110001101000011010110000001101101101001001101111010111011110 00000101000111001100010110000100110001001000101011001001110111010001011110000001111100001010101001 11001101010111000101010100011000101111100101011111110011000001101111110101001111110001100111010010 10010111100110001010110001001110010110110100011010111100110111110101111100101001010001101110101100 01110000111100100101110001011101010001100010111110111011011111100001000001100010110101100111001001 11110010011000000110100111001000000011101111000001100001010100011100000011010110110010001110101111 10011010010100111111100101111010000100001111100101001101011000011011111010100110001101011000001100 01010110101101100001110000100010001001010100010110100100001000011100100000100001101010101001101000 10110100000010111111000101010110101101010100011111011000011010000001001111111110011001010111100010 00001000110000100010111110010100100010101100010100010100011101010100001000100111010010101011011010 10111100101001111110000101100010111111100000100101010000001011101100001101011110010000010010110000 10000101001111110001101100011001001111001010001110110010111110100000101110000101101000111001100010 10001010000100100101101110000101011110011011001100111001000111001100111110001100110011111000011101 10111001001000111111011000110001000110111011001011110010010010110101000011111011110011110110110011 01100101101000010010010101011000001001101001111001110010101010111101000100100111110111110111001110 10001100011010100111111011001001110100010101000100000010001101001101010101100101010000010001111101 11111011110110000110010110100101000111011101001101011100111111011011000010011001110111111110110011 11010000110001001100101100011100101111000100011010001011001111010101111010110001100100111000111011 11111011100111110000110111011010110111000010010011010100001111110110111010100010110110110110101011 11010001111010101100101001010000110100100011111010011100101010010001011010111100101110010000101010 00010011110000001100110011110111001100001101001101101110010110011110101011110111011100111111101000 10100100001101101000001110001110101101011110100101011111101011110101101001010010101001101010010111 00010110000011011111000110010010010010111010110110110011000010110101010101011011110110110100100100 11101001001010111010100010011100110101111101101111011001110100001100010101100110111100001110000001 01001011000001000100000110010010001000110110010001010111101010111000110111010101010001101100111110 11001010101011001101011101000100101111011011000001011010000111000110110110001001000010100010111111 00011000010100011010101111001101110110101111110111001110011110011101111100010010001100001111110001 00101000001011011100110110000001110110101111011011101001001111001010010100001010001101111101101010 00101110011100000001011110111100111101011001100000011000011010000011100110000011110101101001110111 01010011011001111000011111110010110001101000001010111101111011001010000110110011000111001010100110 01111010001101110010100010101010011100001101101110111011100011011111111100000001101001001011001111 01011101101100000100000110001101101101110110000101100101011110001111000101010011011010101011001010 11000100101110010100110011101101100011100001110010010000100110010111111000011001000000100101110100 01111110001101110011011100111011010010100011100111010011111001100001010111100010001111100110000110 00000110100011001101110110011001010000101011110100110101101101100110001010001011101100110001011000 00100001010001010100010101011000010110000101000010011000100001001011100010110111111010110100110001 00101111110000111111100001101101101010110011100110000100001111010000001000001101111110101001100100 10110101010101001110000000010010100100000001000011000110011001011101001111111100111011100111001000 11100000101001000001000001111110011010111010011110000011111100111011011001000011010011011111111101 10000100000110101000100110001111010100010110000101101011100100000100000100011010011000011010110001 10100011110111100011101101101111111000101000010010000101101001010001001001111011000010110100010001 10000000001011110111111010110110011011111100000011000001111111100111101110011011011011110111110100 11011011011110101010011000110111001010111000001000110001000100010100000111101100000110100110010010 00100010000101100111110011110100100000110000011000001000100001010111001010111111010110010010101100 00101001111000101000010001110111110111001000011110000100000011010000110010110011000101111010001111 01101001000001100001000110101110010010000001110011010111000100011000100110011000011000100110100011 01110011110100101110010101101011101000111111011100000001101110101101000010100001010111101001010100 11000110101110101101110111011110001011011000010001110001010100111111000011100100001101110001010111 11111110110010000110111111111110101110110110001010010010000001110010000001001000000000101010100100 01100011010001111001000110000111110000110011101100000001111111011000010000000111111111010000111010 10001011111011011100001011101010001100011010011110111001011100011100000100010101101111010000111010 10000011011101001001111000001001000110111010110001011010001011100001000101011000111010001000010111 01110111010001101100000111110100011110001011111101111100100011011101101010101000011111010000010000 00111110100100000010111110011010001011100100000101111001010111111101010000101001001011001111110010 00101110010100011011111110100101000111010100001011101110110110100111111111010000110110101000000111 10111101110001111010011100110111000111101110001100010011101010111110010011110011100000100101111010 00111100011000110000100110110010010000110110010101101010000001001000111011001110010110001101100010 10101111101110000011111011110001010001001000110001010111000101111011110010010110010001101100100011 11111100111111101100001110100010010000000110010110010110001100110111111011011001010011011001010000 11100101100110011010110000010110101010111100111111010011100001110000100011010000100100000100011010 10111101010011101010101100101111001100101000011110010110010010000011111110001100001011101101101100 00001010110011101110001000101100000011111011010010001100001011100011010101001111011010001010011011 01011011111101101011101110110011011110111000100110001011001010010000100100111100000001100111010010 00100010101101010001011001001011100000111010100110011111001100100101000001000010010000000000011111 01110010010011000111001110110011010100101101110100111101010001001100110111111011010001001111011101 01101000001011001011000001101010101110001110110110111101111011100110111111001010110111011011010010 10010111001111001011000011011010111011010000111001001011010100101110101101101111001111000000010011 01101110010111111000000101011011110110111001110011000110101010000011010010000011011110010001110010 01011101001011110100010010110111010111101110011010011000110010110101011110110100110000010101111000 01101111011111100100011001001111110101101110111111101101001001100111111000101011110110001010010110 01101100010010011110010001010111101110000011111000000110100110000110111101111011010010100000001110 00100100001100101111001011110001000000001101010000101101001000011001010011000011101100101010011000 11110011110111110101010011010001110100011010011110000000111100100111101101010110100111111010100001 10101001001110100101001110111010111111100110111010010100101100110000010010101000101001010100001010 01001001110001101111011101111111100011100000100101010110001011110011101001000111010111110101101101 01110001000010001011010111100111001001000101111101101100011101010001010010100010011000000110111111 10101000101111000100001000000111001110110000111101011000000110110101100010001001011011000111010011 10110000111000000011010010101110010011111000110101001110100110010100000110000001000111101010110000 10011000011001001010110111011111110001000101001110101111011111010010111110000110010100110110010010 01110011001100110101101100110110010110001110110101000011100101001001100100001111110110001110101001 11101110000111010101001100000001110001001100000000010100110011010110101010010111011100110001001101 11111001011100101011111110110111100111001000010110100010001000111011000110100111011010000101011001 81 71 11000001111000101101011110111101011111010001100011010110101111101100111 00100000001011000101010011111011000111000100000000011011000000001111110 00100000111110101011000001110000111111011110110100100000001110001001111 11001010011100111100001100101110100010011100011011110001000011111010010 00101010011011001010110110010111110010010010110100010010110011000001010 00011000100010100000000001100101111110000001100101001011111011011101101 01000111111001001101001011101101110111110010101000000000111111001010001 01100101011000110000001110001110001101011000101111110000111110011010101 11111001000110111100111110110100000100011110101001110110101100110011100 00101100101000001010011100101001011100000100000111110000011110011111110 10011010111001001111101000110110001110010101000011100000010010110100100 10110000001110100101000001010101100110111110011001001001000011010101101 00000111100011101110011010110100001001000011011011010010101011000101110 00100011111101100001110101110001100101011001111101110000101010011000011 01110011001010101110011111111101111010010111101110111001111100100111111 01011101100001011110111000000011011001001001100011000000100111100000110 10110010011111011110101111000100101001100110001100000111011101011000001 00011010101101000010111100110000100010000011101011111011101011000110001 11110110000011110001001101011010110100110101111100110011001111011100111 00010100111000111001000000010101000001010010101010110000101000100011010 01110011100100110100010100011010011110011101111111010110000101000001111 11001010010011111000110011110101010111111100001101110111100010000011011 01110000110110101011001100001100110000111110110001101110100001110010000 01011001001000010100101101110111010010111111111000110101001101110001011 00100111100100010011101000110100110101011000110110100001010100001011000 10101101110000000110000101001101110100001010110110110100000000010110111 11111000011011001010001110111101011011000100000101110111010101011010000 01010000011000110001111000100001100111100001111010110011110101110110111 11111100100001010001111100010011011111101100101110001011011010110100111 11000111110100010010101110010110100001101000101100110111010111000110001 00010101110011101000011111001010110111111100000011110001110010111111100 00010101110111001000011100000100111111111000111011010000101000100011001 10100011110000010100110110001100000100100000001001011000101000101000111 10100000011011000101010101110101100010001000010010000101100100010100011 11010001011100110011011010101100010001110010110101100101101001001110001 00010111100100001101011010110101100011100000000101001101110101111110111 00011010111001000101101101110001010111011101100000101110011000101001001 10000101001010001110111000011110001111010011010110100111101100110111011 01101100000111101000100100000111010001100001110011100111001111101000011 01110000110000000101110000001110111111001001011011110001010111110110100 00011010101001111011010011100010111011000111100110111000111001011111001 01100001111101001011100111000100111100000111101001110000001000101000110 11010000111001001111110010100101000001001001000000100011001010110100011 01010001110011101110101111110001110010111111010110011111000011001001110 11010010110101000100001010001111000110111010011010101100010010000011101 10001100101100000010011001011110110010010000010010011100111010011011000 01010110001110010101001101010001001000011101010111110100001101111000011 10000000101000010101001011000101010011011110001001010110000011100110101 00001101010000101100111101111001011110001000111100100010010011110000100 01111111001101100001111011001000000110111010011001000101110010100001101 11111011000101100010001100001110100100010100101011111000110001011000001 11100110100111111101110101001001110100100110100110000000010000011010001 01101001100101111111100011000010110100100111011010011011011011101111101 01110111100000000011100010111101010000110111111100101011000010110101000 00001010110011010110011000100011000001010111011100000011110010001001011 00101110000001011010000111010110010100000110111011010110100000000111110 11000010111001000100011011000001001111111010011100100001001101101010011 00111110000000111010000000010011010011011011111001001000100110010000011 11111001111000011101010010111010001010010010010100010111101010011010110 01110011100011010101001101001111000010110011010000011011110110100001001 10111011110110101001101001111111101110111010011001001001011110100010100 01011011010000100010000101101111101000110010101111000111110001001000011 10011101100000110011001110101100111110100100110001010101000101011110100 00101101110110111111011001110010011011110000001010010111011010101101010 10110011001011011001000111111110001001111111011010001000011011111111101 11001110111100110010111111110001011000000101010111010001110000101011101 11010010100100101110110000011010001000110100101100011000110001011100110 00000101000011111000101101110111010101010011110100000101101100011011011 01100000001111011001011110111001001101011101111111111001101111001000101 11111010100101001010100100110001101000111011011001110001000101101001000 01000101111100000110011001010101110100110110111001111100100110100110011 01101100010110011101001100100000110110101001110100010101111000010001011 10100001111000000000000000111000011001100100110110111100100110001110110 10111111111101000100101101111000001010111000111101011111001100011101100 01101111101101110000011001011100010100101110101000111011000011000000000 10000110001000011100010111110101101010010001001111111000110010010100111 00110011000100010111001011001001011000101001001101100101110100100011100 11000111100101111001101001111010111110000111111011101011001110010011000 00101111111011101001010010101101111011010110011010010111110111110011011 00000101011110111100110001100001010100111010100101001100000100011111110 10011110001010100110101101001101011111111111000011011010110011101011110 97 45 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111 34 44 00101101110011110001100000100101000011001000 10010110110101111001010100100101011101011110 10101101111111100100011101111010011011101100 01001111010000011100111110000100101110010001 11100100000011110111111101000110100001100111 10110000001011111111000010101110010011010010 11101000000101000101110010110110011001010111 11000000011000101000000110111111001001001100 01111011111011100011010100110111000000010101 01110011000100100000111111010111010001000100 01101001111101011000111010100100100110000100 11011110110101000101011111010001001100010010 01000111010010101101010110110011111111001110 00000010101001000011100100010110101000111110 10101000110010101011110010111011111000011110 00100001010111010110111011101101010000010101 11000111110010110100100010011010100010001100 01000010101011011100101001110000000100111011 00010111011010110000000101101100100101000000 01001100011100111101101000011111001010000001 10100101001011010110111011110010111111100100 11010010110000111010110001001111001110001110 01000111110110110111110110001000111011111101 01010100011101100000101101100010100000101111 11010010110111000101110011111010000111001010 10101111111100000111111000011001000011001010 00100100100010110001000110101101011100100001 01001100010001000100100001011011000000011101 01110111110111110100110110101110101110100100 11101011110110010101111101011111001010101000 00001010100111000000110000110110011000100101 00101111010010100100101110110011010110011011 01011110001001111101000100101110101000110000 00011101010011111001100110100101000110010100
样例输出
no 1 no 1 no 1 no 1 no 1