Toggle navigation
CGOJ
F.A.Qs
ProblemSet
Source/Category
Status
Ranklist
Contest
Login
Language
中文
ئۇيغۇرچە
English
فارسی
ไทย
한국어
Problem M: 小球的颜色
Problem M: 小球的颜色
[Creator :
]
Time Limit :
1.000
sec
Memory Limit :
128 MiB
Submit
ProblemList
Solved: 0
Submit Num: 5
Statistics
ShowOff!
Description
给定
lns="http://www.w3.org/1998/Math/MathML">
n
n
个数字
lns="http://www.w3.org/1998/Math/MathML">
a
1
,
a
2
,
…
,
a
n
a
1
,
a
2
,
…
,
a
n
。我们需要更改一些数字,使得最后数字种类不超过
lns="http://www.w3.org/1998/Math/MathML">
k
k
种,请问最少需要更改多少数字。
Input
第一行:两个整数
lns="http://www.w3.org/1998/Math/MathML">
n
n
与
lns="http://www.w3.org/1998/Math/MathML">
k
k
;
第二行:
lns="http://www.w3.org/1998/Math/MathML">
n
n
个整数
lns="http://www.w3.org/1998/Math/MathML">
a
1
,
a
2
,
…
,
a
n
a
1
,
a
2
,
…
,
a
n
。
数据范围
对于
lns="http://www.w3.org/1998/Math/MathML">
30
%
3
0
%
的数据,
lns="http://www.w3.org/1998/Math/MathML">
1
≤
n
≤
100
1
≤
n
≤
1
0
0
;
对于
lns="http://www.w3.org/1998/Math/MathML">
40
%
4
0
%
的数据,
lns="http://www.w3.org/1998/Math/MathML">
1
≤
n
≤
1000
1
≤
n
≤
1
0
0
0
;
对于
lns="http://www.w3.org/1998/Math/MathML">
100
%
1
0
0
%
的数据,
lns="http://www.w3.org/1998/Math/MathML">
1
≤
k
≤
n
≤
2
×
1
0
5
1
≤
k
≤
n
≤
2
×
1
0
5
。
lns="http://www.w3.org/1998/Math/MathML">
1
≤
a
i
≤
n
1
≤
a
i
≤
n
Output
单个整数,表示答案。
Sample Input
Copy
5 2 1 1 2 2 5
HINT
将颜色为5的小球改成2即可