Codeforces Round 111 (Div. 2)
C
Find Pair
Codeforces
1700
原题
← BD →
翻译中…

You've got another problem dealing with arrays. Let's consider an arbitrary sequence containing $*n*$ (not necessarily different) integers $*a*_{1}$, $*a*_{2}$, ..., $*a*_{*n*}$. We are interested in all possible pairs of numbers ($*a*_{*i*}$, $*a*_{*j*}$), ($1 ≤ *i*, *j* ≤ *n*$). In other words, let's consider all $*n*^{2}$ pairs of numbers, picked from the given array.

翻译中…

For example, in sequence $*a* = {3, 1, 5}$ are $9$ pairs of numbers: $(3, 3), (3, 1), (3, 5), (1, 3), (1, 1), (1, 5), (5, 3), (5, 1), (5, 5)$.

翻译中…

Let's sort all resulting pairs lexicographically by non-decreasing. Let us remind you that pair ($*p*_{1}$, $*q*_{1}$) is lexicographically less than pair ($*p*_{2}$, $*q*_{2}$) only if either $*p*_{1}$ < $*p*_{2}$, or $*p*_{1}$ = $*p*_{2}$ and $*q*_{1}$ < $*q*_{2}$.

翻译中…

Then the sequence, mentioned above, will be sorted like that: $(1, 1), (1, 3), (1, 5), (3, 1), (3, 3), (3, 5), (5, 1), (5, 3), (5, 5)$

翻译中…

Let's number all the pair in the sorted list from $1$ to $*n*^{2}$. Your task is formulated like this: you should find the $*k*$-th pair in the ordered list of all possible pairs of the array you've been given.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 10^{5}, 1 ≤ *k* ≤ *n*^{2}$). The second line contains the array containing $*n*$ integers $*a*_{1}$, $*a*_{2}$, ..., $*a*_{*n*}$ ($- 10^{9} ≤ *a*_{*i*} ≤ 10^{9}$). The numbers in the array can coincide. All numbers are separated with spaces.

翻译中…

Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use cin, cout, streams or the %I64d specificator instead.

翻译中…

Output

翻译中…

In the single line print two numbers — the sought $*k*$-th pair.

翻译中…

Note

翻译中…

In the first sample the sorted sequence for the given array looks as: $(1, 1), (1, 2), (2, 1), (2, 2)$. The $4$-th of them is pair $(2, 2)$.

翻译中…

The sorted sequence for the array from the second sample is given in the statement. The $2$-nd pair there is $(1, 3)$.

翻译中…

样例

Input #1
2 4
2 1
Output #1
2 2
InputCopy OutputCopy
Input #2
3 2
3 1 5
Output #2
1 3
InputCopy OutputCopy
题目信息
题号
160C
时间限制
1 s
内存限制
256 MB
标签
模拟
数学
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。