#P7892. Fenced Pastures

    ID: 21077 Type: Default 1000ms 256MiB

Fenced Pastures

Fenced Pastures

You are given two integers \(n\) and \(m\). Your task is to determine whether it is possible to fence a rectangular area of exactly \(n\) pixel cells using at most \(m\) fence pieces.

To enclose a rectangular area consisting of \(a \times b\) pixel cells, you need to use a fence that forms the border of the rectangle. This requires \((a+1)\) fence pieces horizontally and \((b+1)\) fence pieces vertically, i.e., a total of \((a+1)(b+1)\) fence pieces.

You need to decide if there exists a pair of positive integers \(a\) and \(b\) such that:

[ a \times b = n \quad \text{and} \quad (a+1)(b+1) \le m. ]

If such a pair exists, print Yes; otherwise, print No.

inputFormat

The input consists of two space-separated integers \(n\) and \(m\), where \(n\) is the desired area in pixel cells, and \(m\) is the number of fence pieces available.

outputFormat

Output a single line: Yes if it is possible to fence a rectangle of exactly \(n\) cells using no more than \(m\) fence pieces; otherwise, output No.

sample

1 4
Yes