P10966 K-Anonymous Sequence

Description

![](https://cdn.luogu.com.cn/upload/image_hosting/orua22pd.png)

Input Format

![](https://cdn.luogu.com.cn/upload/image_hosting/lbo5vs9c.png)

Output Format

For each test, output one line containing a single integer-the minimal cost