## An Animal Contest 1 P4 - Alpaca Arrays

View as PDF

Points: 10 (partial)
Time limit: 0.75s
Java 2.0s
Python 2.0s
Memory limit: 256M

Authors:
Problem types

Today, Tony the Alpaca needs some help with an array he found in the grass!

Tony gives you an array of length . He has queries to ask you about the array. Each query is of the form , , , such that .

Given these parameters, Tony wants to know if there are distinct indices and between and inclusive such that .

Also, since Tony hates numbers that are the same, must not be equal to . To keep Tony happy, you must answer all his queries!

#### Input Specification

The first line of input contains two integers and .

The second line of input contains integers .

The final lines will each contain , the parameters for the query.

#### Output Specification

For each query, output YES if there are two distinct indices that multiply to , and NO otherwise.

#### Sample Input 1

5 3
1 5 5 2 3
1 3 25
1 4 6
1 5 10

#### Sample Output 1

NO
NO
YES

#### Sample Input 2

6 4
2 4 2 4 2 4
1 3 8
1 6 5
1 2 1
1 5 16

#### Sample Output 2

YES
NO
NO
NO