#P1166. Game of Swapping Numbers
Game of Swapping Numbers
Background
2021nowcoder多校day1 数据手造,如果想品尝原汁原味的数据,请在nowcoder购买
Description
Given two arrays A, B with length N, you should perform exactly K operations in array A.
For each operation, choose 2 elements and swap the positions of and .
Please maximize .
Format
Input
The first line of input contains two integers $N, K(2 \leq N \leq 5 \times 10^5, 0 \leq K \leq 10^8)$, describing the length of A, B and number of operations.
The second line contains N integers .
The third line contains N integers .
Output
Output one integer, the maximum answer
Samples
3 2
1 2 3
3 2 1
4
3 2
1 2 3
1 2 3
4
3 1
1 2 3
3 2 1
4
Limitation
1s, 1024KiB for each test case.