#P13551. ももいろの鍵
ももいろの鍵
Description
You are given a non-negative integer . You need to partition the numbers into several groups such that the bitwise AND of all numbers in each group is .
Your goal is to maximize the number of groups and provide a valid partitioning scheme.
Input Format
This problem contains multiple test cases in a single test point.
The first line contains a positive integer , indicating the number of test cases.
For each test case, the input is formatted as follows:
- One line containing a non-negative integer .
Output Format
For each test case, first output a positive integer , representing the maximum number of groups.
Then, output lines. Each line should start with a positive integer , indicating the size of the current group, followed by integers representing the elements in the group.
If there are multiple optimal partitioning schemes, you may output any of them.
4
0
1
2
3
1
1 0
1
2 0 1
2
2 2 1
1 0
2
2 1 2
2 0 3
Hint
| Subtask | Points | Special Constraints | |
|---|---|---|---|
| None | |||
| None | |||
For all test cases, it is guaranteed that , , and the sum of across all test cases in a single test point does not exceed .
Generated by Deepseek V3.
京公网安备 11011102002149号