atcoder#ABC247E. [ABC247E] Max Min
[ABC247E] Max Min
Score : points
Problem Statement
We have a number sequence of length and integers and . Find the number of pairs of integers satisfying all the conditions below.
- The maximum value of is , and the minimum is .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 3 1
1 2 3 1
4
pairs satisfy the conditions: .
5 2 1
1 3 2 4 1
0
No pair satisfies the condition.
5 1 1
1 1 1 1 1
15
It may hold that .
10 8 1
2 7 1 8 2 8 1 8 2 8
36