A certain magical rabbit found a row of smarties, with the smartie having flavour . A certain archmage offered the rabbit unlimited carrots if she could figure out how many subarrays had at least distinct flavours of smarties. Since you too love carrots, you decided to get out your computer and start coding up a solution …
Input Specification
The first line will have 2 space separated integers, and .
The next line will have space separated integers, .
Output Specification
A single integer, the number of subarrays with at least distinct flavours of smarties.
Constraints
For all subtasks:
Subtask 1 [40%]
Subtask 2 [60%]
Sample Input
5 3
1 2 3 4 5
Sample Output
6
Comments
This comment is hidden due to too much negative feedback. Show it anyway.
THICC
huh.
Your submission is same as this on both problems, clear copy paste.
yea we know that already
It might be worth mentioning that the answer will overflow in an unsigned 32-bit integer (only for Batch #3 though).
Is my solution just upright wrong, or why do I get WA on Batch 5 Case 4?
correct answer should be 21