Codeforces Round 168 (Div. 1)
A
k-Multiple Free Set
Codeforces
1500
原题
←B →
翻译中…

A $*k*$-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by $*k*$. That is, there are no two integers $*x*$ and $*y*$ $(*x* < *y*)$ from the set, such that $*y* = *x*·*k*$.

翻译中…

You're given a set of $*n*$ distinct positive integers. Your task is to find the size of it's largest $*k*$-multiple free subset.

翻译中…

Input

翻译中…

The first line of the input contains two integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 10^{5}, 1 ≤ *k* ≤ 10^{9}$). The next line contains a list of $*n*$ distinct positive integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(1 ≤ *a*_{*i*} ≤ 10^{9})$.

翻译中…

All the numbers in the lines are separated by single spaces.

翻译中…

Output

翻译中…

On the only line of the output print the size of the largest $*k*$-multiple free subset of ${*a*_{1}, *a*_{2}, ..., *a*_{*n*}}$.

翻译中…

Note

翻译中…

In the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.

翻译中…

样例

Input #1
6 2
2 3 6 5 4 10
Output #1
3
InputCopy OutputCopy
题目信息
题号
274A
时间限制
2 s
内存限制
256 MB
标签
二分
贪心
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。