#C1260. Pair with Product

    ID: 42045 Type: Default 1000ms 256MiB

Pair with Product

Pair with Product

You are given an array of integers and a target integer k. Your task is to determine whether there exists a pair of distinct elements in the array such that their product equals k. In other words, find if there exist indices i and j (i < j) such that

$$a_i \times a_j = k$$

Special attention is required when k = 0: you must have at least two zeros in the array for the answer to be "Yes". Otherwise, output "No".

This is a typical problem where careful handling of edge cases and efficient lookup for complements is required. Use appropriate data structures to achieve an optimal solution.

inputFormat

The input consists of two lines:

  • The first line contains two integers n and k, where n is the number of elements in the array and k is the target product.
  • The second line contains n space-separated integers representing the array elements.

You should read the input from stdin.

outputFormat

Output a single line containing "Yes" (without the quotes) if there exists a pair of distinct elements whose product equals k, otherwise output "No". The output should be printed to stdout.

## sample
5 20
4 5 2 10 0
Yes

</p>