#P10991. [蓝桥杯 2023 国 Python A] 选段排序
[蓝桥杯 2023 国 Python A] 选段排序
Problem Description
Given a sequence of length and two indices . You may choose any interval and sort the elements in this range, , in nondecreasing order.
Find the maximum possible value of after sorting exactly one chosen interval.
Input Format
The first line contains three integers , separated by a single space.
The second line contains integers, representing , separated by a single space.
Output Format
Output one line containing one integer, the maximum value of .
5 1 4
4 5 3 3 1
3
Hint
For of the test cases, and .
For of the test cases, and .
For all test cases, Constraints: , .
Translated by ChatGPT 5