CF1835B.Lottery

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

nn people indexed with integers from 11 to nn came to take part in a lottery. Each received a ticket with an integer from 00 to mm .

In a lottery, one integer called target is drawn uniformly from 00 to mm . kk tickets (or less, if there are not enough participants) with the closest numbers to the target are declared the winners. In case of a draw, a ticket belonging to the person with a smaller index is declared a winner.

Bytek decided to take part in the lottery. He knows the values on the tickets of all previous participants. He can pick whatever value he wants on his ticket, but unfortunately, as he is the last one to receive it, he is indexed with an integer n+1n + 1 .

Bytek wants to win the lottery. Thus, he wants to know what he should pick to maximize the chance of winning. He wants to know the smallest integer in case there are many such integers. Your task is to find it and calculate his chance of winning.

输入格式

In the first line of the input, there are the integers nn , mm , and kk ( 1n1061 \leq n \leq 10^6 , 0m10180 \leq m \leq 10^{18} , 1k1061 \leq k \leq 10^6 ).

In the following line, there are nn integers separated by a single space, denoting the numbers on tickets received by people participating in a lottery. These numbers are integers in the range from 00 to mm .

输出格式

You should output two integers separated by a single space on the standard output. The first should be equal to the number of target values (from 00 to mm ), upon drawing which Baytek wins, given that he chooses his ticket optimally. The second should be equal to the integer Bytek should pick to maximize his chance of winning the lottery.

输入输出样例

  • 输入#1

    3 6 2
    1 4 5

    输出#1

    4 2
  • 输入#2

    7 7 1
    2 4 7 3 0 1 6

    输出#2

    1 5

说明/提示

In the first example, Bytek wins for 44 target values (namely 0,1,2,30, 1, 2, 3 ) if he chooses integer 22 , which is the lowest optimal value. If he chooses 33 , he also wins in four cases, but it is not the lowest value.

首页