Three Square
Time limit1sMemory limit512 MB
Given three rectangles, decide whether they can be rotated and placed without overlap to exactly fill a square.
- Level
Medium4 of 10
- Topics
- Geometry, Implementation, Brute force
- Solved
- No attempts yet
Problem
Inspired by a Mondrian painting you saw, you want to make a three-pane window out of three colored rectangles of glass. You are given the sizes of the three panes of glass. Can you arrange them into a square? You may rotate the panes, but the panes may not overlap.
The three panes must fill the square exactly, with no gaps.
Input
The input consists of three lines. Each line gives the length and the height of one pane of glass, separated by a space.
Every length and height is an integer between and , inclusive.
Output
Print YES on a single line if the three panes can be combined to form a square. Otherwise, print NO.