So I find the editorial of B is too obvious style , so I decided to share a detailed one Here.
We claim that p=[\underbrace{1,2}_{\displaystyle \lfloor \frac{n}{2} \rfloor \text{ times}}] + \underbrace{[1]}_{\displaystyle \text{ if } n \text{ is odd}}
Each subarray of is a valid permutation , Here by our construction appears exactly \lceil \frac{n}{2} \rceil
Each subarray of is a valid permutation , Here by our construction appears exactly \lfloor \frac{n}{2} \rfloor.
Each subarray of is a valid permutation , Here by our construction appears exactly \lceil \frac{n}{2} \rceil
yields a final count of (\lfloor \frac{n}{2} \rfloor + \lceil \frac{n}{2} \rceil)=n and n+\lceil \frac{n}{2} \rceil as the final count.
We want to prove that
we can split the integer and non integer part so we get
From definition of floor and ceil
which is equivalent to
Thus our construction is correct.
Hope it helps..