#P12568. [UOI 2023] An Array and Range Additions
[UOI 2023] An Array and Range Additions
题目描述
Given an array of integers of length .
You can modify the array using the addition operation. To apply the addition operation, you need to perform three sequential actions:
- Choose any integer .
- Choose any subarray of the array.
- Add to each element of the chosen subarray (perform the assignment operation for ).
Find the minimum number of addition operations required to make all elements of the array pairwise distinct.
输入格式
The first line contains a single integer () --- the length of the array.
The second line contains integers () --- the elements of the array.
输出格式
Output a single integer --- the minimum number of addition operations required to make all elements of the array pairwise distinct.
3
1 2 3
0
5
2 3 2 3 2
2
9
2 3 1 1 3 2 1 3 3
2
提示
In the first example, all elements of the array are pairwise distinct.
In the second example, after applying two \textit{addition operations} with parameters , , and , , , the array becomes equal to .
In the third example, after applying two \textit{addition operations} with parameters , , and , , , the array becomes equal to .
Scoring
- ( points): all elements of the array are equal to .
- ( points): for ; for .
- ( points): .
- ( points): .
- ( points): .
- ( points): for .
- ( points): no additional constraints.