CF1923C.Find B
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An array a of length m is considered good if there exists an integer array b of length m such that the following conditions hold:
- i=1∑mai=i=1∑mbi ;
- ai=bi for every index i from 1 to m ;
- bi>0 for every index i from 1 to m .
You are given an array c of length n . Each element of this array is greater than 0 .
You have to answer q queries. During the i -th query, you have to determine whether the subarray cli,cli+1,…,cri is good.
输入格式
The first line contains one integer t ( 1≤t≤104 ) — the number of test cases.
The first line of each test case contains two integers n and q ( 1≤n,q≤3⋅105 ) — the length of the array c and the number of queries.
The second line of each test case contains n integers c1,c2,…,cn ( 1≤ci≤109 ).
Then q lines follow. The i -th of them contains two integers li and ri ( 1≤li≤ri≤n ) — the borders of the i -th subarray.
Additional constraints on the input: the sum of n over all test cases does not exceed 3⋅105 ; the sum of q over all test cases does not exceed 3⋅105 .
输出格式
For each query, print YES if the subarray is good. Otherwise, print NO.
You can output each letter of the answer in any case (upper or lower). For example, the strings yEs, yes, Yes, and YES will all be recognized as positive responses.
输入输出样例
输入#1
1 5 4 1 2 1 4 5 1 5 4 4 3 4 1 3
输出#1
YES NO YES NO