Problem F
Minimum Scalar Product
You are given two vectors
Suppose you are allowed to permute the coordinates of each vector as you wish. Choose two permutations such that the scalar product of your two new vectors is the smallest possible, and output that minimum scalar product.
Input
The first line of the input file contains the number of
testcases,
You may assume that
Output
For each test case, output a line
Case #X: Y
where
Sample Input 1 | Sample Output 1 |
---|---|
2 3 1 3 -5 -2 4 1 5 1 2 3 4 5 1 0 1 0 1 |
Case #1: -25 Case #2: 6 |