#P12551. [UOI 2025] Simple Task
[UOI 2025] Simple Task
题目描述
We call a non-empty sequence of positive integers strange if the sum of its elements is a prime number.
You are given an array of length , consisting of prime numbers. You are also given an integer .
Split the array into non-empty subsequences such that each element of the array belongs to exactly one of them, and the number of strange subsequences among the formed ones is minimized.
In this problem, each test contains several sets of input data. You need to solve the problem independently for each such set.
Note that there is no block "without additional constraints" in this problem.
输入格式
The first line contains one integer --- the number of sets of input data. The description of the input data sets follows.
In the first line of each input data set, two integers , are given --- the length of the array and the number of subsequences into which it needs to be split.
In the second line of each input data set, prime numbers are given --- the elements of the array .
It is guaranteed that the sum of across all input data sets of one test does not exceed .
输出格式
For each set of input data, output the optimal partition in the following format:
- In the first line, output one integer --- the number of strange subsequences among the formed ones;
- In each of the next lines, output integers and --- the number of elements in the corresponding subsequence of the partition and the elements themselves.
Subsequences and their elements may be output in any order.
If there are multiple correct answers, any of them is allowed.
4
3 1
5 5 13
4 2
2 3 5 7
5 3
3 3 5 5 13
6 5
2 2 2 3 3 3
1
3 13 5 5
0
2 2 7
2 3 5
1
1 13
2 3 3
2 5 5
4
1 2
1 2
1 2
1 3
2 3 3
提示
A sequence is called a subsequence of an array if it is possible to remove a certain number of elements from the array (possibly zero) so that the sequence is formed.
Scoring
- ( points): , ;
- ( points): , for all ;
- ( points): , , for all ;
- ( points): --- even, for all ;
- ( points): --- odd, for all ;
- ( points): ;
- ( points): --- even;
- ( points): --- odd.