码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 2665 Kth number

时间:2018-02-11 17:57:41      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:区间   alt   ali   第k大   each   class   sub   following   panel   

Kth number

Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13726    Accepted Submission(s): 4160


Problem Description

Give you a sequence and ask you the kth big number of a inteval.
 

 

Input

The first line is the number of the test cases. 
For each test case, the first line contain two integer n and m (n, m <= 100000), indicates the number of integers in the sequence and the number of the quaere. 
The second line contains n integers, describe the sequence. 
Each of following m lines contains three integers s, t, k. 
[s, t] indicates the interval and k indicates the kth big number in interval [s, t]
 

 

Output

For each test case, output m lines. Each line contains the kth big number.
 

 

Sample Input

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

 

Sample Output

2
 

分析

求一段区间内的第k大值。

主席树~

code

技术分享图片View Code

 

HDU 2665 Kth number

标签:区间   alt   ali   第k大   each   class   sub   following   panel   

原文地址:https://www.cnblogs.com/mjtcn/p/8442512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!