PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000148. Tích trên đoạn có phải lập phương? (Cubic?)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tích trên đoạn có phải lập phương? (Cubic?)
Cubic?
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given a sequence of positive integers , a positive integer is called a perfect cube if there exists a positive integer such that .
For each of queries specifying a contiguous interval , determine whether is a perfect cube. The product may be enormous; only its property must be reported.
Input
The first line contains ; the next line contains values . Each of the next lines contains satisfying .
Output
For each query, print Yes if the product is a perfect cube, or No otherwise. The checker is case-insensitive.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
8 5
7 49 30 1 15 8 6 10
1 2
2 3
4 4
5 8
3 8
Output
Yes
No
Yes
No
Yes
Explanation
for . The product of is , not a cube. is . The product of is , not a cube; gives .