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

建议使用的浏览器:

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

5220:GAL

题目描述
BrotherK likes playing GALGAME, now he wants to design a GALGAME.

Ery has designed $N$ roles for his game, each role can be described as four integers: name, face, character, magic(Just a special parameter, don't care about it). BrotherK need to select some roles for his game, and there are some rules:

Assume BrotherK has selected $K$ roles, i-th role's magic is $M_i$, the equation should be hold: $M_1~xor~M_2~xor~..~xor~M_K~=~0$. (xor means exclusive or, (a xor b) means (a ^ b) in C/C++/Java).

There is not any pair of selected role has same face.

For each character(except there is not any role with the character), BrotherK should select at least one role with the character.

Now, BrotherK wants to know there are how many ways to choose roles.
输入解释
The first line contains a single integer $T$, indicating the number of test cases.

Each test case begins with one integers $N$, indicating the number of roles designed by Ery.Following $N$ lines, i-th line contains three integers
$Face_i,~Character_i$ and $Magic_i$, describing the role whose Name is i.

$T$ is about 100, in most case, $N$ is small.

$1~\le~N~\le~32$.

$1~\le~Face_i, Character_i~\le~N$.

$0~\le~Magic_i~\le~100000$.
输出解释
For each test, print one line.

The line contains a number indicating the number of BrotherK's ways to choose roles.
输入样例
2
3
1 2 1
2 1 1
1 1 1
5
1 2 1
1 1 2
1 2 2
2 1 1
3 2 2
输出样例
1
2

提示
In the first case, BrotherK must choose the first two roles.
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5220

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

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 131072/131072K(Java/Others)