nth_element

View as PDF

Submit solution

Points: 100 (partial)
Time limit: 3.0s
Memory limit: 256M

Authors:
Problem type

總共有n個人 每個人有他的實力值

問排第k大的人實力值是多少


Input

第一行為n,k 第二行為n個人的實力值

Output

輸出第k大的值

Constraints

1<=k<=n<=10000000

-1000000000<=a[i]<=1000000000

(5%) k=1或k=n

(8%) n<=3

(12%)對於所有2<=i<==n,a[i]-a[i-1]=d

(35%)n<=30000

(30%)n<=1000000

(10%)n<=10000000

Sample Input
7 3

1 -2 5 3 4 6 7
Sample Output
5

Comments

There are no comments at the moment.