题库练习 Minimize the error
← 上一题 下一题 →

A11730 | Minimize the error

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given two arrays $A$ and $B$ , each of size $n$ . The error, $E$ , between these two arrays is defined ![](/uploads/acgo/image/b9f8d8ec68a45361_66cd72329c2b.jpeg). You have to perform exactly $k_{1}$ operations on array $A$ and exactly $k_{2}$ operations on array $B$ . In one operation, you have to choose one element of the array and increase or decrease it by $1$ .

Output the minimum possible value of error after $k_{1}$ operations on array $A$ and $k_{2}$ operations on array $B$ have been performed.

输入格式

The first line contains three space-separated integers $n$ ( $1<=n<=10^{3}$ ), $k_{1}$ and $k_{2}$ ( $0<=k_{1}+k_{2}<=10^{3}$ , $k_{1}$ and $k_{2}$ are non-negative) — size of arrays and number of operations to perform on $A$ and $B$ respectively.

Second line contains $n$ space separated integers $a_{1},a_{2},...,a_{n}$ ( $-10^{6}<=a_{i}<=10^{6}$ ) — array $A$ .

Third line contains $n$ space separated integers $b_{1},b_{2},...,b_{n}$ ( $-10^{6}<=b_{i}<=10^{6}$ )— array $B$ .

输出格式

Output a single integer — the minimum possible value of ![](/uploads/acgo/image/d94150ebc9c75dec_fde8aed3c2f7.jpeg) after doing exactly $k_{1}$ operations on array $A$ and exactly $k_{2}$ operations on array $B$ .

输入输出样例

输入 #1
2 0 0
1 2
2 3
输出 #1
2
输入 #2
2 1 0
1 2
2 2
输出 #2
0
输入 #3
2 5 7
3 4
14 4
输出 #3
1
C++ 编辑器
输入
输出