ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Championship 2007

About     Problems     Submit solution     Judge status     Standings
Contest is over

E. Triangular Postcards

Time limit: 1.0 second
Memory limit: 64 MB
Problem illustration
The “Iset” tower owners want to amaze guests invited to the opening ceremony. They decided to send out some unusual postcards, so lots of triangular postcards and envelopes were ordered at a local print shop. These postcards and envelopes vary in size and shape, and the “Iset” office workers are now working hard to sort all the postcards into matching envelopes. They tried to do this in a very simple way: a worker took one postcard and one envelope from the heap, and then checked if they matched each other. If he couldn't put the card into the envelope, he just picked another pair, checked again, and so on.
Eventually the head of the office realized they weren't going to send out all the cards in time if they kept sorting the cards manually. He handed out scanners, so his employees could scan cards and envelopes and use some special software to automatically detect whether the pair matched and how the card should have been placed into the envelope.
You are to help these poor office workers. Write a program that, given the sizes of the card and the envelope (i.e., lengths of two triangles' sides), decides whether the card can be fitted into the envelope.


The first line of input contains 3 integers — lengths of the envelope's edges, in millimeters. The second line contains another 3 integers for the postcard's edges; format is the same. All the edge's lengths never exceed 1 meter. After the postcard is placed inside, the envelope is sealed at 2 edges.


Output “YES” if the card fits into the envelope. Output “NO” otherwise.


30 40 50
50 36 27
200 200 200
210 110 110
Problem Author: Vladimir Yakovlev
Problem Source: The XIIth USU Programing Championship, October 6, 2007
To submit the solution for this problem go to the Problem set: 1566. Triangular Postcards