|
||||||||||
SwapTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/262144 K (Java/Others)Total Submission(s): 62 Accepted Submission(s): 9 Problem Description You are given a sequence of length $N$, and there is also a number $H$ in your hands. In each step, you can swap the number in your hands with one of the numbers in the sequence. Now you need to find the minimum steps to make the sequence in non-decreasing order. Input There are multiple test cases. For each test case, the first line contains two integers $N$ and $H$, denoting the length of the sequence and the number in your hands initially. The second line contains $N$ integers $A_1,A_2,\ldots,A_N$, denoting the initial sequence. $1\leq H,A_i \leq 10^9$. And the sum of $N$ of all test cases is not larger than $300000$. Output For each test case, print an integer in one line, denoting your answer. Sample Input
Sample Output
Source | ||||||||||
|