CF457B.Distributed Join
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
First line contains two integer numbers, m and n ( 1<=m,n<=105 ). Second line contains description of the first cluster with m space separated integers, ai (1<=ai<=109) . Similarly, third line describes second cluster with n space separated integers, bi (1<=bi<=109) .
输入格式
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.
输入输出样例
输入#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.