86 人解决,234 人已尝试。
105 份提交通过,共有 974 份提交。
5.5 EMB 奖励。
单点时限: 5.0 sec
内存限制: 256 MB
Partychen are analyzing a communications network with at most 18 nodes. Character in a matrix i,j (i,j both 0-based,as matrix[i][j]) denotes whether nodes i and j can communicate (‘Y’ for yes, ‘N’ for no). Assuming a node cannot communicate with two nodes at once, return the maximum number of nodes that can communicate simultaneously. If node i is communicating with node j then node j is communicating with node i.
The first line of input gives the number of cases, N(1 ≤ N ≤ 100). N test cases follow.
In each test case,the first line is the number of nodes M(1 ≤ M ≤ 18),then there are a grid by M*M describled the matrix.
For each test case , output the maximum number of nodes that can communicate simultaneously
2 5 NYYYY YNNNN YNNNN YNNNN YNNNN 5 NYYYY YNNNN YNNNY YNNNY YNYYN
2 4 Hint The first test case: All communications must occur with node 0. Since node 0 can only communicate with 1 node at a time, the output value is 2. The second test case: In this setup, we can let node 0 communicate with node 1, and node 3 communicate with node 4.
86 人解决,234 人已尝试。
105 份提交通过,共有 974 份提交。
5.5 EMB 奖励。