cf官网:
洛谷:

In the first test case, one possible optimal sequence of operations is: [1,3,3]→[2,3,3]→[2,4,3]→[3,4,3]→[4,4,3] 。
In the second test case, one possible optimal sequence of operations is: [1,3,4,5,1]→[1,4,4,5,1]→[1,5,4,5,1]→[1,5,5,5,1]→[1,5,6,5,1]→[1,6,6,5,1]→[1,7,6,5,1]
In the first test case, one possible optimal sequence of operations is: $[\color{red}{1}\color{black},3,3] \rightarrow [2, \color{red}{3}\color{black}, 3] \rightarrow [\color{red}{2}\color{black}, 4, 3] \rightarrow [\color{red}{3}\color{black}, 4, 3] \rightarrow [4, 4, 3]$ 。
In the second test case, one possible optimal sequence of operations is: $[1, \color{red}{3}\color{black}, 4, 5, 1] \rightarrow [1, \color{red}{4}\color{black}, 4, 5, 1] \rightarrow [1, 5, \color{red}{4}\color{black}, 5, 1] \rightarrow [1, 5, \color{red}{5}\color{black}, 5, 1] \rightarrow [1, \color{red}{5}\color{black}, 6, 5, 1] \rightarrow [1, \color{red}{6}\color{black}, 6, 5, 1] \rightarrow [1, 7, 6, 5, 1]$