Prime Independence
Description
A set of integers is called prime independent if none of its member is a prime multiple of another member. An integer ais said to be a prime multiple of b if,
a = b x k (where k is a prime [1])
So, 6 is a prime multiple of 2, but 8 is not. And for example, {2, 8, 17} is prime independent but {2, 8, 16} or {3, 6} are not.
Now, given a set of distinct positive integers, calculate the largest prime independent subset.
Input
Input starts with an integer T (≤ 20), denoting the number of test cases.
Each case starts with an integer N (1 ≤ N ≤ 40000) denoting the size of the set. Next line contains N integers separated by a single space. Each of these N integers are distinct and between 1 and 500000 inclusive.
Output
For each case, print the case number and the size of the largest prime independent subset.
Sample Input
3
5
2 4 8 16 32
5
2 3 4 6 9
3
1 2 3
Sample Output
Case 1: 3
Case 2: 3
Case 3: 2
Source
定义a是b的质数倍仅当存在质数p使a=pb
一个集合S是质数独立仅当不存在两个元素a,b属于S使a是b的质数倍
例如{2,8,17}是质数独立的,而{2,8,16}、{3,6}不是
给定n个互不相等的数字,找出一个质数独立的集合S,最大化|S|
先证这幅图是二分图,显然嘛,然后就是裸匹配啦
这题必须用HK算法,否则狂T