#P4552. [Poetize6] IncDec Sequence
[Poetize6] IncDec Sequence
Description
Given a sequence of length , , in each operation you may choose an interval and either add to every number in this interval or subtract from every number in this interval.
What is the minimum number of operations needed to make all numbers in the sequence equal, and under this minimum, how many different final sequences are possible?
Input Format
The first line contains a positive integer . Then lines follow; the integer on the -th line is .
Output Format
Output the minimum number of operations on the first line. Output the number of possible final sequences on the second line.
4
1
1
2
2
1
2
Hint
Constraints: For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号