#P9147. 签到题
签到题
Background
The famous "Data Deletion" is someone who loves traveling! On this day, he arrived in the mysterious country of ZYL.
When entering customs, he was asked a problem. If he answered correctly, he could successfully reach ZY, the capital of ZYL! As the mighty "Data Deletion", he actually spent seconds to come up with a solution. It was really a bit hard! So he decided to use it to test you.
Problem Description
Given a sequence of length , it is guaranteed that are positive integers. You need to choose a position and change to any integer. Maximize the length of the longest strictly increasing substring.
A strictly increasing substring means selecting several consecutive numbers from the sequence such that each later number is greater than the previous one (it cannot be equal to or smaller than the previous one).
For example, in the sequence , the subsequence is a strictly increasing substring, while (not increasing) and (not consecutive) are not.
Input Format
The first line contains a positive integer , representing the length of the sequence.
The second line contains positive integers , representing the sequence .
Output Format
Output one line with one integer, representing the maximum possible length of the longest strictly increasing substring after the modification.
5
1 4 2 2 3
3
5
1 2 3 2 1
4
5
1 2 3 1 5
5
6
8 2 3 1 4 5
4
6
7 2 9 4 5 6
5
Hint
[Sample Explanation #1]
For sample #1, we can change the third position in the sequence to , obtaining the new sequence . The longest strictly increasing substring of this sequence is , with length .
It is easy to prove that there is no modification plan that makes the length of the longest strictly increasing substring greater than .
[Sample Explanation #4]
For sample #4, we can change the third position in the sequence to , obtaining the new sequence . The longest strictly increasing substring of this sequence is , with length .
It is easy to prove that there is no modification plan that makes the length of the longest strictly increasing substring greater than .
[Constraints]
For the first of the testdata, , .
For the first of the testdata, , .
For the first of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5