#P1923. 【深基9.例4】求第 k 小的数
【深基9.例4】求第 k 小的数
Description
Given numbers , output the -th smallest among them. The smallest number is the -th smallest.
Please try not to use nth_element for this problem, because the main point is to practice divide and conquer algorithms.
Input Format
The first line contains two integers, which are and .
The second line contains integers, and the -th number is .
Output Format
Output one integer, the -th smallest number.
5 1
4 3 2 1 5
2
Hint
For of the testdata, , , and is odd.
Translated by ChatGPT 5
京公网安备 11011102002149号