시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 71 | 13 | 9 | 15.254% |
Given two positive integer sequences \({a_1, a_2, \dots, a_n}\) and \({b_1, b_2, \dots, b_n}\) of length \(n\), you must find two sequences \({c_1, c_2, \dots, c_K}\) and \({d_1, d_2, \dots, d_K}\) of length \(K\) satisfying the following conditions:
Subject to these conditions, maximize \(\sum_{i=1}^{K}{a_{c_i}} + \sum_{i=1}^{K}{b_{d_i}}\).
The first line contains an integer \(T\), indicating the number of testcases.
For each testcase:
The first line contains three integers \(n, K, L\).
The second line contains \(n\) integers, indicating \({a_1, a_2, \dots, a_n}\).
The third line contains \(n\) integers, indicating \({b_1, b_2, \dots, b_n}\).
Output one integer on one line, the answer.
For all test cases, \(T \le 10, 1 \le \sigma{n} \le 10^6, 1 \le L\le K \le n\le 2 \times 10^5, 1 \le a_i, b_i \le 10^9\).
5 1 1 1 7 7 3 2 1 4 1 2 1 4 2 5 2 1 4 5 5 8 4 2 1 7 2 7 6 4 1 1 5 8 3 2 4 2 6 9 3 1 7 7 5 4 1 6 6 6 5 9 1 9 5 3 9 1 4 2
14 12 27 45 62