#K78902. Count Removal Ways
Count Removal Ways
Count Removal Ways
Alice and Bob are given a sequence containing the integers from 1 to N (inclusive). They remove two elements in two steps: first, Alice removes one element, and then Bob removes another element. The removal process forms an ordered pair of removed elements.
Your task is to determine the number of valid ways to achieve the removal order [X, Y]. In other words, you need to count the number of ways in which the first removed element equals X and the second removed element equals Y.
A removal is considered valid if and only if:
- Both X and Y are within the range \(1 \leq X, Y \leq N\).
- X and Y are different (i.e. \(X \neq Y\)).
If the above conditions are met, there is exactly 1 valid way; otherwise, the answer is 0.
inputFormat
The input consists of a single line containing three space-separated integers: N, X, and Y.
\(N\) represents the size of the sequence, and \(X\) and \(Y\) represent the two numbers that are expected to be removed in order.
outputFormat
Output a single integer representing the number of valid ways to obtain the removal sequence [X, Y].
## sample5 3 4
1