Unique elements - MarisaOJ: Marisa Online Judge

Unique elements

Time limit: 1000 ms
Memory limit: 256 MB
Given an integer array $A$ of length $n$. Count the number of subarray contain only unique elements (i.e. no value appears more than once). For example, $\{3, 2, 3\}$ is not sastified because value $3$ appears 2 times. ### Input - The first line contains an integers $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the number of unique subarrays. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le 10^5$. ### Example Input: ``` 4 1 2 1 2 ``` Output: ``` 7 ```