codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

62A.md (2357B)


      1 Source: https://codeforces.com/problemset/problem/62/A
      2 
      3 A. A Student's Dream
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 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.
     24 
     25 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.
     26 
     27 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."
     28 
     29 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.
     30 
     31 Input
     32 
     33 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.
     34 
     35 Output
     36 
     37 Print YES or NO, that is, the answer to Petr Palych's question.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 5 1  
     45 10 5
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 YES
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 4 5  
     58 3 3
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 YES
     65 ```
     66 
     67 Input
     68 
     69 ```
     70 1 2  
     71 11 6
     72 ```
     73 
     74 Output
     75 
     76 ```
     77 NO
     78 ```
     79 
     80 Note
     81 
     82 The boy and the girl don't really care who goes to the left.