CF1330A.Dreamoon and Ranking Collection

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Dreamoon is a big fan of the Codeforces contests.

One day, he claimed that he will collect all the places from 11 to 5454 after two more rated contests. It's amazing!

Based on this, you come up with the following problem:

There is a person who participated in nn Codeforces rounds. His place in the first round is a1a_1 , his place in the second round is a2a_2 , ..., his place in the nn -th round is ana_n .

You are given a positive non-zero integer xx .

Please, find the largest vv such that this person can collect all the places from 11 to vv after xx more rated contests.

In other words, you need to find the largest vv , such that it is possible, that after xx more rated contests, for each 1iv1 \leq i \leq v , there will exist a contest where this person took the ii -th place.

For example, if n=6n=6 , x=2x=2 and a=[3,1,1,5,7,10]a=[3,1,1,5,7,10] then answer is v=5v=5 , because if on the next two contest he will take places 22 and 44 , then he will collect all places from 11 to 55 , so it is possible to get v=5v=5 .

输入格式

The first line contains an integer tt ( 1t51 \leq t \leq 5 ) denoting the number of test cases in the input.

Each test case contains two lines. The first line contains two integers n,xn, x ( 1n,x1001 \leq n, x \leq 100 ). The second line contains nn positive non-zero integers a1,a2,,ana_1, a_2, \ldots, a_n ( 1ai1001 \leq a_i \leq 100 ).

输出格式

For each test case print one line containing the largest vv , such that it is possible that after xx other contests, for each 1iv1 \leq i \leq v , there will exist a contest where this person took the ii -th place.

输入输出样例

  • 输入#1

    5
    6 2
    3 1 1 5 7 10
    1 100
    100
    11 1
    1 1 1 1 1 1 1 1 1 1 1
    1 1
    1
    4 57
    80 60 40 20

    输出#1

    5
    101
    2
    2
    60

说明/提示

The first test case is described in the statement.

In the second test case, the person has one hundred future contests, so he can take place 1,2,,991,2,\ldots,99 and place 101101 on them in some order, to collect places 1,2,,1011,2,\ldots,101 .

首页