题库练习 Colored Rectangles
← 上一题 下一题 →

A13743 | Colored Rectangles

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

题目描述

You are given three multisets of pairs of colored sticks:

- $R$ pairs of red sticks, the first pair has length $r_1$ , the second pair has length $r_2$ , $\dots$ , the $R$ -th pair has length $r_R$ ;
- $G$ pairs of green sticks, the first pair has length $g_1$ , the second pair has length $g_2$ , $\dots$ , the $G$ -th pair has length $g_G$ ;
- $B$ pairs of blue sticks, the first pair has length $b_1$ , the second pair has length $b_2$ , $\dots$ , the $B$ -th pair has length $b_B$ ;

You are constructing rectangles from these pairs of sticks with the following process:

1. take a pair of sticks of one color;
2. take a pair of sticks of another color different from the first one;
3. add the area of the resulting rectangle to the total area.

Thus, you get such rectangles that their opposite sides are the same color and their adjacent sides are not the same color.

Each pair of sticks can be used at most once, some pairs can be left unused. You are not allowed to split a pair into independent sticks.

What is the maximum area you can achieve?

输入格式

The first line contains three integers $R$ , $G$ , $B$ ( $1 \le R, G, B \le 200$ ) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks.

The second line contains $R$ integers $r_1, r_2, \dots, r_R$ ( $1 \le r_i \le 2000$ ) — the lengths of sticks in each pair of red sticks.

The third line contains $G$ integers $g_1, g_2, \dots, g_G$ ( $1 \le g_i \le 2000$ ) — the lengths of sticks in each pair of green sticks.

The fourth line contains $B$ integers $b_1, b_2, \dots, b_B$ ( $1 \le b_i \le 2000$ ) — the lengths of sticks in each pair of blue sticks.

输出格式

Print the maximum possible total area of the constructed rectangles.

输入输出样例

输入 #1
1 1 1
3
5
4
输出 #1
20
输入 #2
2 1 3
9 5
1
2 8 5
输出 #2
99
输入 #3
10 1 1
11 7 20 15 19 14 2 4 13 14
8
11
输出 #3
372
C++ 编辑器
输入
输出