#P7382. [COCI 2018/2019 #6] Simfonija
[COCI 2018/2019 #6] Simfonija
Description
You are given two arrays and , each containing elements. Add an integer to every element in array , and then modify at most elements, so that the following expression is minimized:
Input Format
The first line contains integers .
The second line contains integers .
The third line contains integers .
Output Format
Output the minimum value of the expression after the operations.
3 0
1 2 3
4 5 7
1
3 1
1 2 3
4 5 7
0
4 1
1 2 1 2
5 6 7 8
2
Hint
Explanation for Sample 2
When choosing and changing the last number in array to , the two arrays and become exactly the same, so the value of the expression is .
Constraints
For of the testdata, .
For of the testdata, , , .
Note
The score for this problem follows the original COCI settings, with a full score of .
Translated from COCI2018-2019 CONTEST #6 T4 Simfonija.
Translated by ChatGPT 5
京公网安备 11011102002149号