# Extremes after Merging Two Digits Estimated time limit: 0.5 seconds. Memory limit: 128 MB. The actual limit is the reference program's slowest median runtime on the target platform multiplied by $2$ , rounded up to a multiple of $0.5$ seconds. See the [evaluation environment](../../../docs/评测环境与性能.md). ## Story A number gallery has a display that can merge two digits. Its curator wants the largest and smallest numbers that can appear after exactly one operation. (This story was rewritten by GPT-6.) ## Formal Problem Statement A positive base-$k$ integer has $n$ digits $a_1,\ldots,a_n$ , from most significant to least significant. Choose positions $i