CSES Problemset/Sorting and Searching
Distinct Values Subarrays
#3420Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopGiven an array of integers, count the number of subarrays where each element is distinct.
Input
The first line has an integer : the array size.
The second line has integers : the array contents.
Output
Print the number of subarrays with distinct elements.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
4 1 2 1 3
Expected Output
8
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
4 1 2 1 3
Expected Output
8