| Cataratas do Pinhão 2025 |
|---|
| Finished |
Trojack is mapping the genetic diversity of Araucaria trees along an ecological hike that symbolically stretches from Foz do Iguaçu to Curitiba. He collected samples from $$$N$$$ trees in sequence and assigned each one a genetic identifier.
His research seeks to find sections of the trail that are genetically rich. A section is considered "viable for study" if, within it, all of the trees with a genetic marker are unique.
Your task is to help Trojack find the length of the longest continuous section of trees that is "viable for study".
The first line contains an integer $$$N$$$ ($$$1 \leq N \leq 2 \times 10^{5}$$$), the number of trees.
The second line contains $$$N$$$ integers $$$a_1, a_2,\ldots,a_N$$$, where each $$$a_i$$$ ($$$1 \le a_i \le 10^{9}$$$) is the genetic identifier of each tree in the hike.
Output a single integer, the length of the longest viable section.
51 1 3 4 5
4
81 2 1 3 2 7 4 2
5
| Name |
|---|


