Let $p = (a_{1}, a_{2}, \ldots , a_{12})$ be a permutation of $1, 2, \ldots, 12$. We will denote \[S_{p} = |a_{1}-a_{2}|+|a_{2}-a_{3}|+\ldots+|a_{11}-a_{12}|\]We'll call $p$ $\textit{optimistic}$ if $a_{i} > \min(a_{i-1}, a_{i+1})$ $\forall i = 2, \ldots, 11$. $a)$ What is the maximum possible value of $S_{p}$. How many permutations $p$ achieve this maximum?$\newline$ $b)$ What is the number of $\textit{optimistic}$ permtations $p$? $c)$ What is the maximum possible value of $S_{p}$ for an $\textit{optimistic}$ $p$? How many $\textit{optimistic}$ permutations $p$ achieve this maximum?
Problem
Source: 2022 Bulgarian Spring Math Competition, Problem 8.4
Tags: combinatorics, Permutations with restrictions
14.05.2022 14:00
In any permutation $p$, call $a_i$ a $peak$ if $a_{i}>\max (a_{i-1},a_{i+1})$, and a $bottom$ if $a_{i}<\min (a_{i-1},a_{i+1}),$ (to make the definition valid for the endpoints, we let $a_{0}=a_{2}$ and $a_{13}=a_{11}).$ Now we can easily see that for any permutation $p,$ the value of $S_{p}$ only depends on peaks and bottoms Let $p'=(13-a_{1},13-a_{2},...,13-a_{12}),$ then $S_{p}=S_{p'}$, and so for the sake of evaluation (for the sake of counting, we simply multiply by 2), we may assume wlog that $a_{1}$ is a bottom. If $a_{12}$ was bottom as well, then for some $1\le k\le 5$ we have (aside of $a_{1},a_{12},$ the $p_{i}$'s are the peaks and the $b_{j}$'s are the bottoms of $p$): \[S_{p}=-a_{1}+2(p_{1}-b_{1}+p_{2}-b_{2}+...-b_{k-1}+p_{k})-a_{12}=2(p_{1}+p_{2}+...+p_{k})-2(b_{1}+...+b_{k-1})-a_{1}-a_{12}\]\[\le 2(12+11+...+(13-k))-2(1+...+(k-1))-k-(k+1)=2k(12-k)-1\le 69\]And if $a_{12}$ was peak, then for some $0\le k\le 5$ we have \[S_{p}=-a_{1}+2(p_{1}-b_{1}+p_{2}-b_{2}+...+p_{k}-b_{k})+a_{12}=2(p_{1}+p_{2}+...+p_{k})+a_{12}-2(b_{1}+...+b_{k})-a_{1}\]\[\le 2(12+11+...+(13-k))+(12-k)-2(1+...+k)-(k+1)=2k(11-k)+11\le 71\]So $S_{p}\le 71,$ and the equality case should then satisfies the following conditions: 1) $a_{1}=6$ and $a_{12}=7$ 2) $(a_{2},a_{4},a_{6},a_{8},a_{10})$ is a permutation of (8,9,10,11,12) 3) $(a_{3},a_{5},a_{7},a_{9},a_{11})$ is a permutation of (1,2,3,4,5) This counts a total of $5!\cdot 5!$ equality cases, so by returning generality we see that the maximum value of $S_{p}$ is 71, and it is achievable through $2\cdot 5!\cdot 5!=28800$ permutations. This concludes part (a). Now let's consider parts b),c). Notice that the $optimistic$ condition is simply saying that there should be no bottoms, except possibly for the endpoints, so we can only have one peak (if there were 2 peaks, a bottom should appear in between, which violates the optimistic condition, and a peak exists because '12' is always peak) and this peak is $a_{i}=12$. But this would imply that $a_{1}<a_{2}<...<a_{i}=12>a_{i+1}>...>a_{12}\;\;^{(*)}$, and so $$S_{p}=2a_{i}-a_{1}-a_{12}=24-a_{1}-a_{12}\le 21$$This is achievable when $\{a_{1},a_{12}\} =\{1,2\}$ and the rest can be arbitrarywhile preserving (*), this can be easily counted, we shall get a total of $2^{10}=1024$ permutations satisfying $S_{p}=21$ and $p$ optimistic. This concludes part (c) For part (b), we just ignore the condition $\{a_{1},a_{12}\} =\{1,2\}$, we'll get a total of $2^{11}=2048$ optimistic permutations