You are given an array $$$a$$$ of length $$$n$$$. For each $$$k$$$ from $$$2$$$ to $$$n$$$, find the maximum distance between two distinct elements within any subarray of length $$$k$$$.
Formally, for each $$$k$$$, we want to find:
$$$$$$\max \{ j - i \mid 1 \le i \lt j \le n, \, j - i \lt k, \, a_i \neq a_j \}$$$$$$
If no such pair of distinct elements exists for a given $$$k$$$, the answer is $$$-1$$$.
The first line contains a single integer $$$n$$$, representing the length of the array.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, representing the elements of the array.
Output $$$n-1$$$ space-separated integers on a single line. The $$$i$$$-th integer should be the answer for $$$k = i + 1$$$.
41 2 1 2
1 1 3
53 3 3 3 3
-1 -1 -1 -1
51 2 3 4 5
1 2 3 4
| Name |
|---|


