A11147 | Two Seals
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
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$ ).
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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted