Score : $300$ points
We have a sequence of length $N$: $A=(a_1,\ldots,a_N)$. Additionally, you are given an integer $K$.
You can perform the following operation zero or more times.
Determine whether it is possible to sort $A$ in ascending order.
Input is given from Standard Input in the following format:
$N$ $K$ $a_1$ $\ldots$ $a_N$
If it is possible to sort $A$ in ascending order, print Yes
; otherwise, print No
.
5 2 3 4 1 3 4
Yes
The following sequence of operations sorts $A$ in ascending order.
5 3 3 4 1 3 4
No
7 5 1 2 3 4 5 5 10
Yes
No operations may be needed.