CF1114A.Got Any Grapes?
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
For simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.
Andrew, Dmitry and Michal are all grapes' lovers, however their preferences of grapes are different. To make all of them happy, the following should happen:
- Andrew, Dmitry and Michal should eat at least x, y and z grapes, respectively.
- Andrew has an extreme affinity for green grapes, thus he will eat green grapes and green grapes only.
- On the other hand, Dmitry is not a fan of black grapes — any types of grapes except black would do for him. In other words, Dmitry can eat green and purple grapes.
- Michal has a common taste — he enjoys grapes in general and will be pleased with any types of grapes, as long as the quantity is sufficient.
Knowing that his friends are so fond of grapes, Aki decided to host a grape party with them. He has prepared a box with a green grapes, b purple grapes and c black grapes.
However, Aki isn't sure if the box he prepared contains enough grapes to make everyone happy. Can you please find out whether it's possible to distribute grapes so that everyone is happy or Aki has to buy some more grapes?
It is not required to distribute all the grapes, so it's possible that some of them will remain unused.
为简化问题,我们假设葡萄仅有三种:青葡萄、紫葡萄和黑葡萄。
安德鲁(Andrew)、德米特里(Dmitry)和米哈尔(Michal)都是葡萄爱好者,但他们对葡萄的偏好各不相同。为了使三人都开心,需满足以下条件:
- 安德鲁、德米特里和米哈尔分别至少需吃下 x、y 和 z 颗葡萄;
- 安德鲁极度偏爱青葡萄,因此他只吃青葡萄,且仅吃青葡萄;
- 另一方面,德米特里不喜欢黑葡萄——除黑葡萄外的任何种类均可满足他;换言之,德米特里可吃青葡萄和紫葡萄;
- 米哈尔口味普通——他总体上喜爱葡萄,只要数量足够,任何种类的葡萄他都会欣然接受。
由于深知朋友们如此钟爱葡萄,阿基(Aki)决定与他们共同举办一场葡萄派对。他已准备了一个盒子,其中装有 a 颗青葡萄、b 颗紫葡萄和 c 颗黑葡萄。
然而,阿基不确定自己准备的盒子中葡萄数量是否足以让所有人都满意。你能帮忙判断:是否存在一种葡萄分配方案,使得三人都开心?还是阿基必须额外购买一些葡萄?
注意:无需将所有葡萄全部分完,因此可能有部分葡萄剩余未被使用。
输入格式
The first line contains three integers x, y and z (1≤x,y,z≤105) — the number of grapes Andrew, Dmitry and Michal want to eat.
The second line contains three integers a, b, c (1≤a,b,c≤105) — the number of green, purple and black grapes in the box.
第一行包含三个整数 x、y 和 z(1≤x,y,z≤105)——分别表示安德鲁、德米特里和米哈伊尔想要吃的葡萄数量。
第二行包含三个整数 a、b 和 c(1≤a,b,c≤105)——分别表示盒中青色、紫色和黑色葡萄的数量。
输出格式
If there is a grape distribution that allows everyone to be happy, print "YES", otherwise print "NO".
如果存在一种葡萄分配方案使得所有人都开心,则输出 "YES",否则输出 "NO"。
输入输出样例
输入#1
1 6 2 4 3 3
输出#1
YES
输入#2
5 1 1 4 3 2
输出#2
NO
说明/提示
In the first example, there is only one possible distribution:
Andrew should take 1 green grape, Dmitry should take 3 remaining green grapes and 3 purple grapes, and Michal will take 2 out of 3 available black grapes.
In the second test, there is no possible distribution, since Andrew is not be able to eat enough green grapes. :(
在第一个例子中,只有一种可能的分配方式:
安德鲁应取 1 颗青葡萄,德米特里应取剩余的 3 颗青葡萄和 3 颗紫葡萄,而米哈尔则取 3 颗可选黑葡萄中的 2 颗。
在第二个测试用例中,不存在可行的分配方式,因为安德鲁无法吃到足够数量的青葡萄。:(
输入解题思路,AI测评打分。不知道怎么写?