E - Placing Rectangles 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 500

問題文

正整数 X, Y に対し、2 次元平面上において以下の条件を満たす長方形を良い長方形と呼びます。

  • 全ての辺は x 軸または y 軸に並行である。
  • 全ての頂点に対し、その x 座標は 0 以上 X 以下の整数であり、その y 座標は 0 以上 Y 以下の整数である。

面積がそれぞれ A 以上、B 以上、C 以上であるような 3 つの良い長方形を重ならないように配置することができるか判定してください。

ただし、3 つの長方形が重ならないとは、どの 2 つの長方形についても、それらの共通部分の面積が 0 であることを指します。

制約

  • 1 \leq X, Y \leq 10^9
  • 1 \leq A, B, C \leq 10^{18}
  • 入力は全て整数である。

入力

入力は以下の形式で標準入力から与えられる。

X Y A B C

出力

問題文で与えられた条件を満たすように長方形を配置することができるならば Yes、できないならば No と出力せよ。


入力例 1

3 3 2 2 3

出力例 1

Yes

下の図のように配置すればよいです。長方形内の数値は面積を表します。

2 \geq A, 3 \geq B, 3 \geq C であるので、問題文で与えられた条件を満たします。

image


入力例 2

3 3 4 4 1

出力例 2

No

条件を満たすように配置することはできません。


入力例 3

1000000000 1000000000 1000000000000000000 1000000000000000000 1000000000000000000

出力例 3

No

Score : 500 points

Problem Statement

For positive integers X and Y, a rectangle in a two-dimensional plane that satisfies the conditions below is said to be good.

  • Every edge is parallel to the x- or y-axis.
  • For every vertex, its x-coordinate is an integer between 0 and X (inclusive), and y-coordinate is an integer between 0 and Y (inclusive).

Determine whether it is possible to place the following three good rectangles without overlapping: a good rectangle of an area at least A, another of an area at least B, and another of an area at least C.

Here, three rectangles are considered to be non-overlapping when the intersection of any two of them has an area of 0.

Constraints

  • 1 \leq X, Y \leq 10^9
  • 1 \leq A, B, C \leq 10^{18}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y A B C

Output

If it is possible to place three rectangles under the conditions specified in the Problem Statement, print Yes; otherwise, print No.


Sample Input 1

3 3 2 2 3

Sample Output 1

Yes

The figure below shows a possible placement, where the number in a rectangle represents its area.

We can see that 2 \geq A, 3 \geq B, 3 \geq C, satisfying the conditions.

image


Sample Input 2

3 3 4 4 1

Sample Output 2

No

There is no possible placement under the conditions.


Sample Input 3

1000000000 1000000000 1000000000000000000 1000000000000000000 1000000000000000000

Sample Output 3

No