CF263B.Squares

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya has found a piece of paper with a coordinate system written on it. There are n distinct squares drawn in this coordinate system. Let's number the squares with integers from 1 to n. It turned out that points with coordinates (0, 0) and (a__i, a__i) are the opposite corners of the i-th square.

Vasya wants to find such integer point (with integer coordinates) of the plane, that belongs to exactly k drawn squares. We'll say that a point belongs to a square, if the point is located either inside the square, or on its boundary.

Help Vasya find a point that would meet the described limits.

瓦西娅发现了一张写有坐标系的纸。该坐标系中画有 nn 个互不相同的正方形。我们将这些正方形编号为 11 到 nn。已知第 ii 个正方形的一组对角顶点坐标分别为 (0, 0)(0,\,0) 和 (ai, ai)(a_i,\,a_i)。

瓦西娅希望找到平面上的一个整点(即横纵坐标均为整数的点),使得该点恰好位于所画的 kk 个正方形内(含边界)。我们称一个点属于某个正方形,当且仅当该点位于该正方形内部或其边界上。

请帮助瓦西娅找出一个满足上述条件的点。

输入格式

The first line contains two space-separated integers n, k (1 ≤ n, k ≤ 50). The second line contains space-separated integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 109).

It is guaranteed that all given squares are distinct.

第一行包含两个以空格分隔的整数 nn、kk(1 ≤ n, k ≤ 501 ≤ n, k ≤ 50)。第二行包含以空格分隔的整数 a1, a2, ..., ana_1, a_2, ..., a_n(1 ≤ ai ≤ 1091 ≤ a_i ≤ 10^9)。

保证所有给定的正方形互不相同。

输出格式

In a single line print two space-separated integers x and y (0 ≤ x, y ≤ 109) — the coordinates of the point that belongs to exactly k squares. If there are multiple answers, you are allowed to print any of them.

If there is no answer, print "-1" (without the quotes).

在一行中输出两个用空格分隔的整数 xx 和 yy(0 ≤ x, y ≤ 1090 \le x, y \le 10^9)—— 表示恰好属于 kk 个正方形的点的坐标。如果存在多个答案,输出任意一个即可。

如果不存在这样的点,则输出 -1(不带引号)。

输入输出样例

  • 输入#1

    4 3
    5 1 3 4

    输出#1

    2 1
  • 输入#2

    3 1
    2 4 1

    输出#2

    4 0
  • 输入#3

    4 50
    5 1 10 2

    输出#3

    -1

输入解题思路,AI测评打分。不知道怎么写?

首页