当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3736:Choose The Soldiers

题目描述
There are N matrixs of soilders.
Now here comes an urgent task and you want to choose M of them to complete the task.
But if more than 2 selected soldiers are in the same row or column of the same matrix they will chat to each other and the efficiency will be too low.
Of course you want to avoid low efficiency.
How many ways can you choose them?
输入解释
There are several test cases. The first line of the input is an integer T (0<T<=100) indicates the number of test cases.
The first line of each test case is a line of 2 positive integers N(0<N<=20) and M (0<M<=800).
Then N lines of 2 integers, m and n (0<m,n<=20) indicate the number of row and column of each matrix.
输出解释
The result may be very large so for each test case output the result module by 123456789 instead in a single line.
输入样例
2
1 1
1 1
2 2
1 1
2 2
输出样例
1
10
来自杭电HDUOJ的附加信息
Author javaman
Recommend notonlysuccess

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 ACMDIY第二届群赛

源链接: HDU-3736

最后修改于 2020-10-25T23:06:31+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)