A9655. Distributed Join
编程题
普及/提高-
知识点
题目描述
First line contains two integer numbers, $m$ and $n$ ( $1<=m,n<=10^{5}$ ). Second line contains description of the first cluster with $m$ space separated integers, $a_{i}$ $(1<=a_{i}<=10^{9})$ . Similarly, third line describes second cluster with $n$ space separated integers, $b_{i}$ $(1<=b_{i}<=10^{9})$ .
输入格式
Print one integer — minimal number of copy operations.
输出格式
In the first example it makes sense to move all the rows to the second partition of the second cluster which is achieved in $2+6+3=11$ operations
In the second example Piegirl can copy each row from $B$ to the both partitions of the first cluster which needs $2·3=6$ copy operations.
In the second example Piegirl can copy each row from $B$ to the both partitions of the first cluster which needs $2·3=6$ copy operations.
输入输出样例
输入 #1
2 2 2 6 3 100
输出 #1
11
输入 #2
2 3 10 10 1 1 1
输出 #2
6
说明/提示
In the first example it makes sense to move all the rows to the second partition of the second cluster which is achieved in $2+6+3=11$ operations
In the second example Piegirl can copy each row from $B$ to the both partitions of the first cluster which needs $2·3=6$ copy operations.
In the second example Piegirl can copy each row from $B$ to the both partitions of the first cluster which needs $2·3=6$ copy operations.