luogu#P10798. 「CZOI-R1」消除威胁
「CZOI-R1」消除威胁
Background
The testdata for this problem has been fixed.
Problem Description
Given a sequence .
We say an interval in sequence is a threat if and only if and , and satisfies .
You may perform any number of operations on . In each operation, choose an and change it to . What is the minimum number of distinct threat intervals in the final sequence ?
Two intervals and are different if and only if or .
Input Format
The first line contains an integer , denoting the length of .
The second line contains integers, denoting .
Output Format
The first line contains a positive integer, denoting the minimum number of threat intervals.
8
3 2 1 2 3 -1 3 3
2
Hint
Constraints
This problem uses bundled tests.
- Subtask #1 (): .
- Subtask #2 (): .
- Subtask #3 (): .
- Subtask #4 (): all are equal.
- Subtask #5 (): .
- Subtask #6 (): no special constraints.
For of the testdata, and .
Translated by ChatGPT 5