## hdu4417

maksyuki 发表于 oj 分类，标签: ,

# Super Mario

Problem Description

Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to the boss’s castle as a line (the length is n), on every integer point i there is a brick on height hi. Now the question is how many bricks in [L, R] Mario can hit if the maximal height he can jump is H.

Input

The first line follows an integer T, the number of test data.
For each test data:
The first line contains two integers n, m (1 <= n <=10^5, 1 <= m <= 10^5), n is the length of the road, m is the number of queries.
Next line contains n integers, the height of each brick, the range is [0, 1000000000].
Next m lines, each line contains three integers L, R,H.( 0 <= L <= R < n 0 <= H <= 1000000000.)

Output

For each case, output "Case X: " (X is the case number starting from 1) followed by m lines, each line contains an integer. The ith integer is the number of bricks Mario can hit for the ith query.

Sample Input

1
10 10
0 5 2 7 5 4 3 8 7 7
2 8 6
3 5 0
1 3 1
1 9 4
0 1 0
3 5 5
5 5 1
4 6 3
1 5 7
5 7 3

Sample Output

Case 1:

4

0

0

3

1

2

0

1

5

1

Source

2012 ACM/ICPC Asia Regional Hangzhou Online
{"ft_lang_label":"__label__en","ft_lang_prob":0.516848,"math_prob":0.98561275,"size":4777,"snap":"2019-35-2019-39","text_gpt3_token_len":1833,"char_repetition_ratio":0.14833438,"word_repetition_ratio":0.033507854,"special_character_ratio":0.4814737,"punctuation_ratio":0.1529954,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9747086,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-21T14:29:28Z\",\"WARC-Record-ID\":\"<urn:uuid:20772304-873d-487d-844b-02b2013390f6>\",\"Content-Length\":\"110597\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e02bb0ec-9efd-43c9-a342-e73f92fec0d7>\",\"WARC-Concurrent-To\":\"<urn:uuid:51a9c730-4e9d-4b21-a96d-731263f63d7b>\",\"WARC-IP-Address\":\"43.242.131.194\",\"WARC-Target-URI\":\"http://www.maksyuki.com/?p=2679\",\"WARC-Payload-Digest\":\"sha1:EODEVGY5WHDS3IWSPYQH52DTOTS5KETO\",\"WARC-Block-Digest\":\"sha1:42GNBRZSFRJBR7V7SNDUIY3CXK7XGRRW\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027316021.66_warc_CC-MAIN-20190821131745-20190821153745-00500.warc.gz\"}"}