CF1874A.Jellyfish and Game
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Jellyfish has n green apples with values a1,a2,…,an and Gellyfish has m green apples with values b1,b2,…,bm.
They will play a game with k rounds. For i=1,2,…,k in this order, they will perform the following actions:
- If i is odd, Jellyfish can choose to swap one of her apples with one of Gellyfish's apples or do nothing.
- If i is even, Gellyfish can choose to swap one of his apples with one of Jellyfish's apples or do nothing.
Both players want to maximize the sum of the values of their apples.
Since you are one of the smartest people in the world, Jellyfish wants you to tell her the final sum of the value of her apples after all k rounds of the game. Assume that both Jellyfish and Gellyfish play optimally to maximize the sum of values of their apples.
水母有 n 个绿色苹果,其价值分别为 a1,a2,…,an;果冻水母有 m 个绿色苹果,其价值分别为 b1,b2,…,bm。
他们将进行 k 轮游戏。对于 i=1,2,…,k(按此顺序),他们依次执行以下操作:
- 若 i 为奇数,水母可选择将其一个苹果与果冻水母的一个苹果交换,或选择不进行任何操作;
- 若 i 为偶数,果冻水母可选择将其一个苹果与水母的一个苹果交换,或选择不进行任何操作。
双方玩家均希望最大化自己所持苹果的价值总和。
由于你是世界上最聪明的人之一,水母希望你告诉她:在全部 k 轮游戏结束后,她所持苹果的价值总和是多少?假设水母与果冻水母均以最优策略进行游戏,即始终以最大化各自苹果价值总和为目标。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤2000). The description of the test cases follows.
The first line of each test case contains three integers, n, m and k (1≤n,m≤50, 1≤k≤109) — the number of green apples Jellyfish has, the number of green apples Gellyfish has and the number of rounds of the game respectively.
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤109) — the values of Jellyfish's green apples.
The third line of each test case contains m integers b1,b2,…,bm (1≤bi≤109) — the values of Gellyfish's green apples.
Do note that the sum of n and m over all test cases are both not bounded.
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤2000)。随后是各测试用例的描述。
每个测试用例的第一行包含三个整数 n、m 和 k(1≤n,m≤50,1≤k≤109)——分别表示 Jellyfish 拥有的青苹果数量、Gellyfish 拥有的青苹果数量以及游戏的轮数。
每个测试用例的第二行包含 n 个整数 a1,a2,…,an(1≤ai≤109)——表示 Jellyfish 的青苹果的价值。
每个测试用例的第三行包含 m 个整数 b1,b2,…,bm(1≤bi≤109)——表示 Gellyfish 的青苹果的价值。
请注意:所有测试用例中 n 的总和与 m 的总和均无上界。
输出格式
For each test case, output a single integer — the final sum of the values of Jellyfish's apples.
对于每个测试用例,输出一个整数——即水母(Jellyfish)的苹果的价值之和。
输入输出样例
输入#1
4 2 2 1 1 2 3 4 1 1 10000 1 2 4 5 11037 1 1 4 5 1 9 1 9 8 1 1 1 2 1
输出#1
6 1 19 2
说明/提示
In the first test case, Jellyfish will swap the apple of value 1 and 4.
In the second test case, both players will swap the two apples 10,000 times.
In the fourth test case, Jellyfish will do nothing.
在第一个测试用例中,水母将交换价值为 1 和 4 的苹果。
在第二个测试用例中,两名玩家都将交换两个苹果 10,000 次。
在第四个测试用例中,水母将不执行任何操作。
输入解题思路,AI测评打分。不知道怎么写?