Remove One Element

题意翻译

## 题目描述 给出一个长度为$n$的序列 你可以选择性地删除掉该序列中的一个元素,这样,最后的序列长度为$n-1$或$n$ 你需要求出,在选择性的删除操作后,该序列的 最长连续上升子序列的长度 ## 输入格式 第一行一个整数$n$,表示序列的长度 第二行$n$个整数,表示题目中描述的序列$a_1,a_2, \dots ,a_n$ ## 输出格式 一行一个整数,表示在选择性的删除操作后,该序列的 最长连续上升子序列的长度 ### 数据范围 $2 \le n \le 2 \cdot 10^5$,$1 \le a_i \le 10^9$ 感谢 @_Wolverine 提供的翻译

题目描述

You are given an array $ a $ consisting of $ n $ integers. You can remove at most one element from this array. Thus, the final length of the array is $ n-1 $ or $ n $ . Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subarray $ a $ with indices from $ l $ to $ r $ is $ a[l \dots r] = a_l, a_{l + 1}, \dots, a_r $ . The subarray $ a[l \dots r] $ is called strictly increasing if $ a_l < a_{l+1} < \dots < a_r $ .

输入输出格式

输入格式


The first line of the input contains one integer $ n $ ( $ 2 \le n \le 2 \cdot 10^5 $ ) — the number of elements in $ a $ . The second line of the input contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \le a_i \le 10^9 $ ), where $ a_i $ is the $ i $ -th element of $ a $ .

输出格式


Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $ a $ after removing at most one element.

输入输出样例

输入样例 #1

5
1 2 5 3 4

输出样例 #1

4

输入样例 #2

2
1 2

输出样例 #2

2

输入样例 #3

7
6 5 4 3 2 4 3

输出样例 #3

2

说明

In the first example, you can delete $ a_3=5 $ . Then the resulting array will be equal to $ [1, 2, 3, 4] $ and the length of its largest increasing subarray will be equal to $ 4 $ .