Bricks
Time limit1sMemory limit128 MB
Given a rectangular brick and a rectangular hole, decide whether the brick can pass through the hole in any orientation.
- Level
Medium6 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem

A prisoner of the "IF" castle plans to escape by taking his cell's brick wall apart, one brick at a time. To keep the guards from noticing, he must secretly get rid of every brick he removes. Each brick is a rectangular box measuring inches and is far too strong to break. In the cell floor there is a small rectangular drain of size inches that continues straight down as a well of the same cross-section; it is so deep that its depth can be ignored. The prisoner has measured , , , , exactly (to a tenth of an inch). Determine whether the bricks can be dropped through the hole.
Input
A single line with five numbers , , , , separated by spaces. , , are the lengths of the brick's sides and , are the lengths of the hole's sides. Every length is between and inches inclusive and has at most one digit after the decimal point.
Output
Print YES on a single line if the bricks can be disposed of through the hole, and NO otherwise.