There are several small pandas in Panda emoticon. There are N Panda emoticons in row. The numbers of small pandas in i-th Panda emoticon is A[i], i is from 1 to N. Letf(l,r)= ∑[A[i]≥K1 and A[i]≤K2] .i is from l to r inclusive. [Expression] means thatExpressionis a logical expression, if the expression is true, then [Expression] is 1, else 0. Calculate the result off(l,r).
问题 A: Array of Orz Pandas
时间限制:3000 ms 内存限制:128 MB提交:100 解决:30
[ 提交][ 状态][ 讨论版]
题目描述
输入
The first line of the input contains two integers N and M denoting the number of Panda emoticons and the number of queries. Next line contains N integers denoting A[i].
Next M lines, each line contains four integersl ,rK1, K2.
There are several test cases, please process to end of file.
1 ≤ N ≤ 100000, 1 ≤ M ≤ 100000.
0 ≤ A[i] ≤ 10^9, 1 ≤l≤r≤N.
0 ≤ K1 ≤ K2 ≤ 10^9.
输出
For each test case, output M lines, i-th of them is the result of the i-th query.
样例输入
4 2 1 2 3 4 1 3 2 3 1 1 1 1
样例输出
2 1
提示
한국어中文فارسیEnglishไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM