AmazonOA #190
Amazon Care Get Minimum Score
估计中等可在线判题
Find the minimum number of distinct values in a non-empty contiguous subarray that contains both target values; if the two targets are equal, output 1 if the value occurs and 0 otherwise. This site adds that 0 is output whenever no valid subarray exists.
输入格式
The first line contains n u v; the second line contains the array. This site uses 1≤n≤200000, with array values and targets in −10^9..10^9.
输出格式
Output a single integer, the answer.
样例 1
输入:
6 1 5
1 2 2 2 5 2
输出:
3
样例 2
输入:
5 1 2
1 3 2 1 4
输出:
2
样例 3
输入:
3 1 1
2 4 9
输出:
0
样例说明
The answers are 3, 2 and 0.