CF786C Till I Collapse

Description

Rick and Morty want to find MR. PBH and they can't do it alone. So they need of Mr. Meeseeks. They Have generated $ n $ Mr. Meeseeks, standing in a line numbered from $ 1 $ to $ n $ . Each of them has his own color. $ i $ -th Mr. Meeseeks' color is $ a_{i} $ . Rick and Morty are gathering their army and they want to divide Mr. Meeseeks into some squads. They don't want their squads to be too colorful, so each squad should have Mr. Meeseeks of at most $ k $ different colors. Also each squad should be a continuous subarray of Mr. Meeseeks in the line. Meaning that for each $ 1

Input Format

N/A

Output Format

N/A

Explanation/Hint

For the first sample testcase, some optimal ways of dividing army into squads for each $ k $ are: 1. $ [1],[3],[4],[3,3] $ 2. $ [1],[3,4,3,3] $ 3. $ [1,3,4,3,3] $ 4. $ [1,3,4,3,3] $ 5. $ [1,3,4,3,3] $ For the second testcase, some optimal ways of dividing army into squads for each $ k $ are: 1. $ [1],[5],[7],[8],[1],[7],[6],[1] $ 2. $ [1,5],[7,8],[1,7],[6,1] $ 3. $ [1,5,7],[8],[1,7,6,1] $ 4. $ [1,5,7,8],[1,7,6,1] $ 5. $ [1,5,7,8,1,7,6,1] $ 6. $ [1,5,7,8,1,7,6,1] $ 7. $ [1,5,7,8,1,7,6,1] $ 8. $ [1,5,7,8,1,7,6,1] $