5884: BZOJ1884:[Ipsc2008]Discover All Sets

Memory Limit:357 MB Time Limit:50 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description


输入格式

The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line. Each test case looks as follows: The first line contains three positive integer N, M and K giving the number of different properties of the cards, the number of different values of a single property, and the number of cards drawn. Each of the next K lines describes one of these cards. The i-th of these lines (1 ≤ i ≤ K) contains exactly N numbers pi,j (1 ≤ j ≤ N), 1 ≤ pi,j ≤ M. Value pi,j is the value of the j-th property of the i-the card.


输出格式


样例输入

1
4 3 12
1 1 1 2
2 3 3 3
2 2 3 1
1 3 1 3
3 3 3 3
1 2 1 1
2 1 3 2
1 1 3 2
2 3 2 3
1 3 2 3
3 2 1 1
3 1 2 2

样例输出

11

提示


题目来源

没有写明来源

加入题单

算法标签: