#P3847. [TJOI2007] 调整队形
[TJOI2007] 调整队形
Description
- Add one person to the left or right end (their clothing color can be chosen as needed).
- Insert one person between any two adjacent people (their clothing color can be chosen as needed).
- Remove one person.
- Change one person's clothing color.
The teacher wants to know, for the current lineup, the minimum number of adjustments needed. Please write a program to answer this.
Because joining the chorus is very popular, you may assume there is an unlimited number of people available, i.e., you can always add someone when needed. Clothing colors can be chosen arbitrarily as well.
Input Format
The first line contains an integer ().
The second line contains integers, from left to right, representing the current clothing color ID of each member, all integers from to .
Output Format
Output a single number: the minimum number of adjustments needed to make the lineup meet the requirement.
5
1 2 2 4 3
2
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号