← 返回 google 的题目列表Longest Increasing Subarray Length; with One Modification Allowed
类型:online_judge
Given an integer array nums, compute the length of the longest strictly increasing contiguous subarray.
Follow-up: you may modify at most one element (change it to any integer). After the modification, compute the maximum possible length of the longest strictly increasing contiguous subarray.
Input format (suggested)
Line 1: integer n
Line 2: n integers for nums
Output format (suggested)
Output two integers:
the answer without modification
the best answer with at most one modification
Constraints (for self-testing)
1 <= n <= 2e5
-1e9 <= nums[i] <= 1e9
Sample tests 1.
5
1 2 3 4 5
Output:
5 5
5
1 2 2 3 4
Output:
3 5
4
4 3 2 1
Output:
1 2
6
1 5 2 3 4 0
Output:
3 5
1
10
Output:
1 1
Example
Input
5
1 2 3 4 5
Output
5 5