#K16076. Longest Consecutive Run

    ID: 24498 Type: Default 1000ms 256MiB

Longest Consecutive Run

Longest Consecutive Run

You are given a sequence of integers. Your task is to determine the longest contiguous subsequence in which all the elements are identical. The subsequence is defined by its starting and ending positions (both 1-indexed). In case of a tie, the subsequence that appears first in the sequence should be selected.

Formally, if the sequence is \(a_1, a_2, \dots, a_n\), find indices \(i\) and \(j\) (with \(1 \le i \le j \le n\)) such that for all \(k\) with \(i \le k \le j\), \(a_k = a_i\) and the number \(j - i + 1\) is maximized. If there are multiple such subsequences, choose the one with the smallest \(i\).

inputFormat

The input is read from standard input (stdin). The first line contains a single integer \(n\) — the number of elements in the sequence. The second line contains \(n\) space-separated integers representing the sequence.

outputFormat

Print two integers separated by a space: the starting and ending positions (1-indexed) of the longest contiguous subsequence where all elements are equal. The output should be written to standard output (stdout).

## sample
11
1 2 2 2 3 3 1 1 1 1 2
7 10

</p>