CF62A.A Student's Dream
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Statistics claims that students sleep no more than three hours a day. But even in the world of their dreams, while they are snoring peacefully, the sense of impending doom is still upon them.
A poor student is dreaming that he is sitting the mathematical analysis exam. And he is examined by the most formidable professor of all times, a three times Soviet Union Hero, a Noble Prize laureate in student expulsion, venerable Petr Palych.
The poor student couldn't answer a single question. Thus, instead of a large spacious office he is going to apply for a job to thorium mines. But wait a minute! Petr Palych decided to give the student the last chance! Yes, that is possible only in dreams.
So the professor began: "Once a Venusian girl and a Marsian boy met on the Earth and decided to take a walk holding hands. But the problem is the girl has a__l fingers on her left hand and a__r fingers on the right one. The boy correspondingly has b__l and b__r fingers. They can only feel comfortable when holding hands, when no pair of the girl's fingers will touch each other. That is, they are comfortable when between any two girl's fingers there is a boy's finger. And in addition, no three fingers of the boy should touch each other. Determine if they can hold hands so that the both were comfortable."
The boy any the girl don't care who goes to the left and who goes to the right. The difference is only that if the boy goes to the left of the girl, he will take her left hand with his right one, and if he goes to the right of the girl, then it is vice versa.
统计学声称,学生每天睡眠时间不超过三小时。但即便在他们的梦境之中,当他们正安然打着呼噜时,那种大难临头的压迫感依然挥之不去。
一名可怜的学生梦见自己正在参加数学分析考试,而主考官正是有史以来最令人畏惧的教授——一位三次苏联英雄、学生开除领域的诺贝尔奖得主、德高望重的彼得·帕雷奇(Petr Palych)。
这名可怜的学生一道题也答不上来。因此,他将无法进入宽敞明亮的办公室工作,而只能去钍矿井谋生。但且慢!彼得·帕雷奇教授决定给这名学生最后一次机会!是的,这只有在梦中才可能发生。
于是教授开口道:“从前,一位金星女孩与一位火星男孩在地球上相遇,并决定牵手散步。但问题在于:女孩左手有 al 根手指,右手有 ar 根手指;男孩则相应地左手有 bl 根手指,右手有 br 根手指。他们仅在牵手时彼此感到舒适——条件是:女孩的任意两根手指之间都必须恰好夹着一根男孩的手指(即女孩的每两根相邻手指之间都有一根男孩的手指);此外,男孩的任意三根手指不得相互接触。请判断:他们能否以某种方式牵手,使得双方均感到舒适?”
男孩与女孩并不在意谁在左、谁在右。区别仅在于:若男孩站在女孩左侧,则他用右手牵女孩的左手;若男孩站在女孩右侧,则他用左手牵女孩的右手。
输入格式
The first line contains two positive integers not exceeding 100. They are the number of fingers on the Venusian girl's left and right hand correspondingly. The second line contains two integers not exceeding 100. They are the number of fingers on the Marsian boy's left and right hands correspondingly.
第一行包含两个不超过 100 的正整数,分别表示金星女孩左手和右手的手指数。
第二行包含两个不超过 100 的整数,分别表示火星男孩左手和右手的手指数。
输出格式
Print YES or NO, that is, the answer to Petr Palych's question.
打印 YES 或 NO,即彼得·帕利奇问题的答案。
输入输出样例
输入#1
5 1 10 5
输出#1
YES
输入#2
4 5 3 3
输出#2
YES
输入#3
1 2 11 6
输出#3
NO
说明/提示
The boy and the girl don't really care who goes to the left.
男孩和女孩实际上并不在意谁往左走。
输入解题思路,AI测评打分。不知道怎么写?