cswork / OA打开练习工作台

AdobeOA #4

Partition Array into Equal-Length Distinct Subsequences

估计简单可在线判题

考点(AI 标注)哈希计数

Put every array element into exactly one subsequence of length k so that the values within each group are pairwise distinct; subsequences keep the original index order but need not be contiguous.

输入格式

The first line contains n k, and the second line contains n integers. OCR004 gives the definition and 005 completes the original bounds: 1≤n≤100000, 1≤k≤n, 1≤a[i]≤100000.

输出格式

Output Yes or No.

样例 1

输入:

4 2
1 2 3 4

输出:

Yes

样例 2

输入:

4 3
1 2 2 3

输出:

No

样例 3

输入:

4 2
3 5 3 2

输出:

Yes

样例说明

The outputs of the three public examples are, in order: Yes; No; Yes. Verified by independent enumeration or direct simulation.