Score : 1200 points
There are N arrays. The length of each array is M and initially each array contains integers (1,2,...,M) in this order.
Mr. Takahashi has decided to perform Q operations on those N arrays. For the i-th (1≤i≤Q) time, he performs the following operation.
Mr. Takahashi wants to make N arrays exactly the same after performing the Q operations. Determine if it is possible or not.
The input is given from Standard Input in the following format:
N M Q a_1 a_2 ... a_Q
Print Yes
if it is possible to make N arrays exactly the same after performing the Q operations.
Otherwise, print No
.
2 2 3 2 1 2
Yes
You can perform the operations as follows.
3 2 3 2 1 2
No
2 3 3 3 2 1
Yes
You can perform the operations as follows.
3 3 6 1 2 2 3 3 3
No