Rund was busy this weekend preparing her computer graphics project, so she gave Bitar the following task to complete:
Given an array $a$ of $n$ integers, you have to move the elements in the array to $k$ non-empty arrays (each array has a sub-sequence from the main array) such that you maximize the result of ${\sum_{i = 1}^k mex(array[i])}$.
The MEX (minimum excluded) of an array is the smallest non-negative integer that does not belong to the array.
For example: the MEX of [2,2,1] is 0 , the MEX of [1,2,0] is 3.
Check the Note for further explanation if needed.