FitThePaintings
Practice
3.6 (711 votes)
Problem
86% Success 4743 Attempts 1s Time Limit 256MB Memory 1024 KB Max Code

You have 2 paintings of size a x b and c x d. You want to hang the paintings inside a rectangular board on the wall. The board has dimensions n x m. You are allowed to rotate the paintings but at least one edge of each of the paintings must be parallel to an edge of the board. The paintings can touch each other and the edges of the board but cannot overlap or go beyond the edge of the board. Is it possible to place the paintings on the board?

Input:
The input contains 3 lines in the form -
n m
a b
c d
First line contains space separated integers n and m. Second line contains space separated integers a and b. Third line contains space separated integers c and d.

Output:
If the paintings can be placed inside the board, print "Yes", print "No" otherwise.

Constraints:
All integers are in the range 1 to 1000.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
102 votes
Tags:
EasySearching
Points:30
8 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingMediumTwo dimensional
Points:50
1 votes
Tags:
ApprovedData StructuresHardMatrixSegment Trees