logo AlgoBeat OnlineJudge
登录 注册

#101884. [BZOJ 1884] [Ipsc2008]Discover All Sets

内存限制:357 MiB 时间限制:100000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

输入格式

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

数据范围与提示