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

建议使用的浏览器:

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

6926:Team

题目描述
A school has a total of $3*n$ students, divided evenly into $A$ group, $B$ group or $C$ group, with $n$ in each group. Everyone has an ability value $v_i$, the tacit value between two students is $f(i,j)=(v_i+v_j)*(v_i \oplus v_j) \% M$, where $\oplus$ means bitwise exclusive OR operation. As the competition coach of this school, you need to select exactly $m$ teams to participate in the $CCPC$ competition in the second half of the year.

Specifically, Each team contains exactly three students, and the three students are from different groups.
Let the team members from the $A,B,C$ group be $a,b,c$, then the tacit value of this team is $f(a,b)+f(a,c)$.

Please find out the maximum sum of the tacit values of the $m$ teams.
输入解释
The input consists of multiple test cases. The first line contains an integer $T$ $(1 \leq T \leq 10)$ — the number of test cases.
The description of the test cases follows.

The first line contains three integers $n,m,M$ $(1 \leq m \leq n \leq 200,10 \leq M \leq 2000)$.

Then follows three lines, each line contains $n$ integers $v_1,v_2,\dots,v_n$ $(1 \leq v_i \leq 2000)$ — the ability value of each student in group $A,B$ and $C$ .
输出解释
For each test case, print the answer.
输入样例
2
3 2 10
1 2 3
4 5 6
7 8 9
4 4 21
5 4 2 6
9 1 10 2
4 3 99 12
输出样例
27
98
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6926

最后修改于 2021-06-22T18:18:55+00:00 由爬虫自动更新

共提交 0

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