304376: CF837C. Two Seals

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Two Seals

题意翻译

有一个 $a*b$ 的网格,现在给 $n$ 个 $x_i*y_i $ 的矩形,且每个矩形可以翻转$ 90°$ ,让你选择其中两个找出最大的覆盖面积放入网格中,保证不能重合。

题目描述

One very important person has a piece of paper in the form of a rectangle $ a×b $ . Also, he has $ n $ seals. Each seal leaves an impression on the paper in the form of a rectangle of the size $ x_{i}×y_{i} $ . Each impression must be parallel to the sides of the piece of paper (but seal can be rotated by 90 degrees). A very important person wants to choose two different seals and put them two impressions. Each of the selected seals puts exactly one impression. Impressions should not overlap (but they can touch sides), and the total area occupied by them should be the largest possible. What is the largest area that can be occupied by two seals?

输入输出格式

输入格式


The first line contains three integer numbers $ n $ , $ a $ and $ b $ ( $ 1<=n,a,b<=100 $ ). Each of the next $ n $ lines contain two numbers $ x_{i} $ , $ y_{i} $ ( $ 1<=x_{i},y_{i}<=100 $ ).

输出格式


Print the largest total area that can be occupied by two seals. If you can not select two seals, print 0.

输入输出样例

输入样例 #1

2 2 2
1 2
2 1

输出样例 #1

4

输入样例 #2

4 10 9
2 3
1 1
5 10
9 11

输出样例 #2

56

输入样例 #3

3 10 10
6 6
7 7
20 5

输出样例 #3

0

说明

In the first example you can rotate the second seal by 90 degrees. Then put impression of it right under the impression of the first seal. This will occupy all the piece of paper. In the second example you can't choose the last seal because it doesn't fit. By choosing the first and the third seals you occupy the largest area. In the third example there is no such pair of seals that they both can fit on a piece of paper.

Input

题意翻译

有一个 $a*b$ 的网格,现在给 $n$ 个 $x_i*y_i $ 的矩形,且每个矩形可以翻转$ 90°$ ,让你选择其中两个找出最大的覆盖面积放入网格中,保证不能重合。

加入题单

上一题 下一题 算法标签: