atcoder#ABC238G. [ABC238G] Cubic?
[ABC238G] Cubic?
Score : points
Problem Statement
Given a sequence of numbers, answer the following questions.
- In the -th question, you are given integers and . Is $A_{L_i} \times A_{L_i+1} \times \dots \times A_{R_i}$ a cubic number?
Here, a positive integer is said to be a cubic number when there is a positive integer such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain Yes
if, in the -th question, $A_{L_i} \times A_{L_i+1} \times \dots \times A_{R_i}$ is a cubic number, and No
otherwise.
The checker is case-insensitive; output can be either uppercase or lowercase.
8 5
7 49 30 1 15 8 6 10
1 2
2 3
4 4
5 8
3 8
Yes
No
Yes
No
Yes
- For the first question, is a cubic number.
- For the second question, is not a cubic number.
- For the third question, is a cubic number.
- For the fourth question, is not a cubic number.
- For the fifth question, $30 \times 1 \times 15 \times 8 \times 6 \times 10 = 216000$ is a cubic number.