## THICC '17 P5 - Smarties

View as PDF

Points: 7 (partial)
Time limit: 1.4s
Memory limit: 128M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

A certain magical rabbit found a row of smarties, with the th 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.

#### Sample Input

5 3
1 2 3 4 5

#### Sample Output

6

• commented on Dec. 20, 2020, 12:38 p.m.

I prefer smarties to carrots

• commented on March 12, 2019, 11:53 a.m.

THICC

• commented on Nov. 30, 2018, 8:36 p.m.
• commented on Dec. 1, 2018, 6:30 a.m. edited

Your submission is same as this on both problems, clear copy paste.

• commented on Nov. 30, 2018, 8:52 p.m. edited

• commented on Oct. 1, 2017, 5:48 p.m.

It might be worth mentioning that the answer will overflow in an unsigned 32-bit integer (only for Batch #3 though).

• commented on Aug. 6, 2017, 7:14 p.m. edited

Is my solution just upright wrong, or why do I get WA on Batch 5 Case 4?

• commented on Aug. 7, 2017, 1:20 a.m.
10 4
1 2 3 4 4 4 1 2 3 4