Square Deal
Time limit2sMemory limit512 MB
Given three rectangles, decide whether they can be glued edge to edge into a square, with rotations allowed.
- Level
Medium4 of 10
- Topics
- Geometry, Implementation, Brute force
- Solved
- No attempts yet
Problem
You are given the height and width of three rectangles. Decide whether the three rectangles can be glued together along their edges to form a single square. The three rectangles must cover the square with no gaps, and they must not overlap. A rectangle may be rotated by 90 degrees.
Input
The input consists of three lines. Line contains the height and the width of the -th rectangle, separated by a space.
and .
Output
Print YES on one line if the three rectangles can form a square, and NO otherwise.