CF1874A.Jellyfish and Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Jellyfish has nn green apples with values a1,a2,,ana_1, a_2, \dots, a_n and Gellyfish has mm green apples with values b1,b2,,bmb_1,b_2,\ldots,b_m .

They will play a game with kk rounds. For i=1,2,,ki=1,2,\ldots,k in this order, they will perform the following actions:

  • If ii is odd, Jellyfish can choose to swap one of her apples with one of Gellyfish's apples or do nothing.
  • If ii 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 kk rounds of the game. Assume that both Jellyfish and Gellyfish play optimally to maximize the sum of values of their apples.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt ( 1t20001 \leq t \leq 2000 ). The description of the test cases follows.

The first line of each test case contains three integers, nn , mm and kk ( 1n,m501 \leq n, m \leq 50 , 1k1091 \leq k \leq 10^9 ) — 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 nn integers a1,a2,,ana_1, a_2, \dots, a_n ( 1ai1091 \leq a_i \leq 10^9 ) — the values of Jellyfish's green apples.

The third line of each test case contains mm integers b1,b2,,bmb_1, b_2, \dots, b_m ( 1bi1091 \leq b_i \leq 10^9 ) — the values of Gellyfish's green apples.

Do note that the sum of nn and mm over all test cases are both not bounded.

输出格式

For each test case, output a single integer — the final sum of the values of Jellyfish's apples.

输入输出样例

  • 输入#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 11 and 44 .

In the second test case, both players will swap the two apples 10,00010,000 times.

In the fourth test case, Jellyfish will do nothing.

首页