zoukankan      html  css  js  c++  java
  • Competition ranking (match)

    Description


    ( ext{Smart}) participated in the (n) (operatorname{OnlineJudge}) tour. His ranking position in the first competition is (operatorname{a[1]}), and his ranking position in the second competition is...(operatorname{a[2]}), in the (n) The ranking position of this competition is (operatorname{a[n]}).
    ( ext{Smart}) will participate in (x) contests later, please find the largest (v) so that ( ext{Smart}) can collect from (1) to $v after playing (x) contests All ranking positions of $. In other words, you need to find the largest (v) so that after (x) matches for ( ext {Smart}), for any (1le i le v), there may be a match, ( text{Smart}) will be ranked in the (i) position.
    For example, if $n = 6, x = 2 $ and ( ext{a = [3, 1, 1, 5, 7, 10]}), the answer is (v = 5), because if in the next In the two games, he will get the (2) and (4) respectively. He will collect all the ranking positions from (1) to (5), so it is possible to get (v = 5).

    Format


    Input

    The first line contains an integer (t), which represents the number of groups of test data in the input. Each set of test data contains two rows:
    The first line contains two integers (n, x), and the second line contains (n) positive and non-zero integers representing ( ext{a[1], a[2]}, cdots, ext{a[n]}).

    Output

    For each set of test data, output one line, that is, the maximum output is (v), and the meaning is shown in the question.

    Sample


    Input

    3
    6 2
    3 1 1 5 7 10
    1 100
    100
    11 1
    1 1 1 1 1 1 1 1 1 1 1
    

    Output

    5
    101
    2
    

    Hint


    (100\%) Data: (1 leq t leq 5,1 leq n,x leq 100,1 leq a[i] leq 100).

    Sample Code


    Code is not available!
    
  • 相关阅读:
    【USACO】又买饲料 单调队列dp
    数论:px+py 不能表示的最大数为pq-p-q的证明
    codeforces round #419 E. Karen and Supermarket
    [USACO4.1]麦香牛块Beef McNuggets
    【USACO】 录制唱片
    【USACO】 洞穴奶牛
    【USACO】奶牛抗议 树状数组+dp
    【USACO】 奶牛会展
    【LSGDOJ 2015】数页码
    阿里云合作伙伴峰会SaaS加速器专场 | 商业加持,迈进亿元俱乐部
  • 原文地址:https://www.cnblogs.com/jiupinzhimaguan/p/13817294.html
Copyright © 2011-2022 走看看