/ OPS / 题库 /

Dividing

Dividing

#描述#
There are N(N is an even number) people in ZJUT. Each person in ZJUT loves some ones and hates the others. Is it possible to divide them to N/2 groups in which the two people love each other?

#格式#
##输入格式##
The first line gives a number T, means the number of test cases.
The first line of each test case gives a number N, and then follows a N*N matrix.
The elements of the matrix are either 0 or 1. If the j-th number in the i-th row is 1, it means the i-th person loves the j-th person, else he doesn’t love him. N,T &lt= 16

##输出格式##
If it is possible to divide them, print “Yes”, else print “No”.

#样例1#
##样例输入1##

2
4
1 1 1 0
1 1 0 1
1 1 1 0
0 1 0 1
4
1 1 0 0
0 1 0 1
1 0 1 0
0 0 1 1

##样例输出1##

Yes
No

#限制#
1000ms
32768KB

#提示#

#来源#
lily

信息

ID
1395
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者