CF837C.Two Seals
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
一位非常重要的人物有一张尺寸为 a×b 的矩形纸张。
此外,他有 n 个印章。每个印章在纸张上留下的印痕是一个尺寸为 xi×yi 的矩形。每个印痕必须与纸张的边平行(但印章可以旋转 90∘)。
这位非常重要的人物希望从中选择两个不同的印章,并在纸张上各盖一次印。每个被选中的印章恰好盖一次印。印痕之间不能重叠(但可以边相接),且它们所占据的总面积应尽可能大。那么,两个印章印痕所能占据的最大总面积是多少?
输入格式
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).
第一行包含三个整数 n、a 和 b(1 ≤ n, a, b ≤ 100)。
接下来的 n 行,每行包含两个数 xi、yi(1 ≤ xi, yi ≤ 100)。
输出格式
Print the largest total area that can be occupied by two seals. If you can not select two seals, print 0.
输出两只海豹所能占据的最大总面积。如果无法选出两只海豹,则输出 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.
在第一个例子中,你可以将第二个印章旋转 90 度,然后将其印痕置于第一个印章印痕的正下方,这样便可覆盖整张纸。
在第二个例子中,你不能选择第三个印章,因为它无法适配。通过选择第一个和第三个印章,你可以覆盖最大的面积。
在第三个例子中,不存在一对印章能够同时适配于一张纸上。
输入解题思路,AI测评打分。不知道怎么写?