Introduction - If you have any usage issues, please Google them yourself
Drunbee very fond of the dog, he n dogs, every dog has a loyalty val. The lunchtime, n dogs will line up, the No. 1 ~~ n. Drunbee each will select a range, from to choose loyalty k small dog interval feeding, you can tell he interval loyalty k small dog' s loyalty is how much you? ★ data input input behavior first two positive integers n, m. M times fed n dogs. The next line, n integer, followed by the first loyalty of dogs, dogs loyalty, ......, the dogs n loyalty. Next m rows, each three integers x, y, k, indicates the the inquired interval [x, y] of the k-th small loyalty. Data to ensure that each query interval may intersect, but any two not mutually inclusive asking are legitimate. n < = 10 ^ 5 m < = 5* 10 ^ 4 val < = 10 ^ 9 ★ data output for each inquiry line of output is an integer that indicates the demand loyalty. Enter the sample output of Example 7 2 1 5 2 6 3 7 4 2 7 3 1 5 3 4 3