• [I] Sequence

  • 时间限制: 5000 ms 内存限制: 65535 K
  • 问题描述
  • Given a sequence with n integers a0, a1, ..., an and an integer q. Each time I will
    give you four integers a, b, l and r, I want to know the total number of a i which
    satisfied l≤i≤r and a≤a i ≤b .

  • 输入
  • Input starts with an integer T ( T ≤10 ), denoting the number of test
    cases.
    Each case starts with a line containing two integers n ( n≤100000
    )denoting the length of the sequence and q ( q≤100000 ) denoting the query
    times.
    The second line will contain n integers
    a 0, a 1, ..., a n ( 1≤a i ≤100000 ).
    Next q lines each line will contain four integers a, b, l, r(
    1≤a≤b≤100000,1≤l≤r ≤n ).
  • 输出
  • For each test case, print the case number, then q lines following, each line contains one
    integer denoting your answer.
  • 样例输入
  • 1
    5 2
    1 2 3 4 5
    1 4 2 3
    1 5 1 5
  • 样例输出
  • Case 1:
    2
    5
  • 提示
  • 来源
  • Alex@NBUT
  • 操作

显示春菜