#P1091. [NOIP 2004 提高组] 合唱队形
[NOIP 2004 提高组] 合唱队形
Description
students stand in a row. The music teacher will ask students to step out so that the remaining students form a "chorus formation."
A chorus formation is defined as follows: suppose the remaining students are numbered from left to right as , and their heights are . They satisfy $t_1 < \cdots < t_i > t_{i+1} > \cdots > t_k \ (1 \le i \le k)$.>
Your task is: given the heights of all students, compute the minimum number of students that must be removed so that the remaining students form a chorus formation.
Input Format
Two lines.
- The first line contains an integer (), the total number of students.
- The second line contains integers separated by spaces. The -th integer () is the height (in centimeters) of the -th student.
Output Format
Output a single integer: the minimum number of students who must be removed.
8
186 186 150 200 160 130 197 220
4
Hint
For 50% of the testdata, it is guaranteed that .
For all the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号