A9874 | Gerald is into Art
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an $a_{1}×b_{1}$ rectangle, the paintings have shape of a $a_{2}×b_{2}$ and $a_{3}×b_{3}$ rectangles.
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
输入格式
The first line contains two space-separated numbers $a_{1}$ and $b_{1}$ — the sides of the board. Next two lines contain numbers $a_{2},b_{2},a_{3}$ and $b_{3}$ — the sides of the paintings. All numbers $a_{i},b_{i}$ in the input are integers and fit into the range from $1$ to $1000$ .
输出格式
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
输入输出样例
输入 #1
3 2 1 3 2 1
输出 #1
YES
输入 #2
5 5 3 3 3 3
输出 #2
NO
输入 #3
4 2 2 3 1 2
输出 #3
YES
That's how we can place the pictures in the first test:

And that's how we can do it in the third one.


And that's how we can do it in the third one.

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