#P4661. Amr and The Large Array
Amr and The Large Array
Amr and The Large Array
题面翻译
给定一个数组,请取出一个子段,需要保证子段中的数字出现的最大值与原数组的数字出现最大值一样,问这个子段长度最短是多少。
题目描述
Amr has got a large array of size . Amr doesn't like large arrays so he intends to make it smaller.
Amr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to be the maximum number of times that some number occurs in this array. He wants to choose the smallest subsegment of this array such that the beauty of it will be the same as the original array.
Help Amr by choosing the smallest subsegment possible.
输入格式
The first line contains one number ( ), the size of the array.
The second line contains integers ( ), representing elements of the array.
输出格式
Output two integers ( ), the beginning and the end of the subsegment chosen respectively.
If there are several possible answers you may output any of them.
样例 #1
样例输入 #1
5
1 1 2 2 1
样例输出 #1
1 5
样例 #2
样例输入 #2
5
1 2 2 3 1
样例输出 #2
2 3
样例 #3
样例输入 #3
6
1 2 2 1 1 2
样例输出 #3
1 5
提示
A subsegment of an array from to is an array of size where for all