3054: New Matryoshka

时间限制:4000 ms 内存限制:128 MB
上传者:
提交:3 通过:3

题目描述

Russian Matryoshka is a wooden toy of Russia's specialties. It is usually made up of a set of one or more wooden dolls of the same pattern, with a flat bottom that can stand upright. Colors are red, blue, green, purple, etc. The most common pattern is a girl dressed in Russian national costume called "Matroska", which also became the generic name of this doll.


$Rainbow Island$ has it's own Matryoshka, but it is different from the Matryoshka in Russia. It's composition rules are as follows:
  1. The wooden doll is a two-dimensional figure with only two shapes, circle or square.
  2. When two dolls are tangent to one another, the small one can be put into the the big one. For example, a circle with a radius of 2 can be put into a square with sides of 4.
  3. Square dolls with side length of $x$ can be put into another square dolls with side length of $y$ when $x \leq y$. So as circle dolls.
  4. A doll can be put into only one doll (but can be put continuously, which means doll $A$ can be put into doll $B$, and the $B$ with $A$ can be put into doll $C$, while $A$ and $B$ couldn't be put into $C$ separately).
  5. The thickness of all dolls can be ignored.
  6. If doll $A$ has been put into doll $B$, the area of the final doll is the area of $B$. For example, a circle with a radius of 2 has been put into a square with sides of 4, and the final area is 16.
The well-known black heart businessman $ctr$ is going to $ShuHuiYuan$ for money with his dolls (there are $n$ circle with the radius of $r_{i}$, $m$ square with the side length of $a_{i}$). In order to to carry more dolls, he want to put some of them into the others to make the final area minimum.

Can you tell him what is the minimum final area?

输入格式

The first line contains an integer number $T$, the number of test cases.

For each test case :
The first line contains two integers $n, m(1 \leq n + m \leq 200)$, the number of circle and square dolls.

The following $n$ lines, each contains an integers $r_{i}(1 \leq r_{i} \leq 10^{5})$, the radius of the $i^{th}$ circle doll.

The following $m$ lines, each contains an integers $a_{i}(1 \leq a_{i} \leq 10^{5})$, the side length of the $i^{th}$ square doll.

输出格式

For each test case print the minimum final area, round to two decimal places.

输入样例 复制

2
5 0
4 5 5 4 2
3 2
10 7 4
5 4

输出样例 复制

25.00
149.00