2785. hear tree

单点时限: 2.0 sec

内存限制: 256 MB

If a tree falls in the forest, and there’s nobody there to hear, does it make a sound? This classic conundrum was coined by George Berkeley (1685-1753), the Bishop and influential Irish philosopher whose primary philosophical achievement is the advancement of what has come to be called subjective idealism. He wrote a number of works, of which the most widely-read are Treatise Concerning the Principles of Human Knowledge (1710) and Three Dialogues between Hylas and Philonous (1713) (Philonous, the “lover of the mind,” representing Berkeley himself).

输入格式

In each testcase, a forest contains P people numbered from 1 to P and N trees numbered from 1 to N. Standard input consists of a line containing P and N and K followed by K lines, containing a pair of integers i and j, indicating that person i has heard tree j fall. People may have different opinions as to which trees, according to Berkeley, have made a sound. How many different opinions are represented in the input? Two people hold the same opinion only if they hear exactly the same set of trees. You may assume that P < 100 and N < 100.

输出格式

Output one line,with the answer described above;

样例

Input
1
3 4 6
1 2
3 3
1 3
2 2
3 2
2 4
Output
2

22 人解决,36 人已尝试。

28 份提交通过,共有 101 份提交。

5.4 EMB 奖励。

创建: 12 年,9 月前.

修改: 5 年,1 月前.

最后提交: 1 年,10 月前.

来源: ECNU 2009 ACM selective trial From waterloo

题目标签