#d11107. 加加减减
加加减减
Add and Subtract
Problem Source
See this link.
Problem Description
Given a sequence of length .
In each operation you may choose an interval and add to or subtract from all numbers in that interval.
Find the minimum number of operations needed to make all numbers in the sequence equal, and also, under the condition of using the minimum number of operations, how many different final sequences can be obtained.
Input Format
One line with an integer (), the length of the array.
One line with integers, the -th being ( is within the range of int).
Output Format
The first line outputs the minimum number of operations.
The second line outputs how many different results can be obtained in the end.
Sample Input
4
1 1 2 2
Sample Output
1
2
Constraints
- .
- is within the range of a 32-bit signed integer.