#P17338. 【MX-X30-T4】超立方体

    ID: 19622 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>Special Judge位运算构造梦熊比赛

【MX-X30-T4】超立方体

Problem Description

You are given two integers n,kn,k. Now you have a graph with 2n2^n vertices, numbered 0∼2n−10\sim 2^n-1. For any two vertices x,yx,y, there is an edge between them if and only if popc(x⊕y)=1\mathrm{popc}(x\oplus y)=1, that is, these two numbers differ in exactly one bit in binary.

You need to choose kk simple cycles (cycles with no repeated vertices) in this graph, such that each vertex belongs to exactly one simple cycle. You need to output a construction or report that there is no solution.

Input Format

This problem contains multiple test cases. The first line contains an integer TT indicating the number of test cases.

Each test case contains one line with two integers n,kn,k.

Output Format

Output separately for each test case.

If you think this test case has no solution, output one line with the string No\texttt{No}.

Otherwise, first output one line with the string Yes\texttt{Yes}, followed by kk lines.

In each line, the first integer ll denotes the length of the cycle, then output v1,v2,v3,…,vlv_1,v_2,v_3,\dots,v_l in the order along the cycle.

You must ensure that these vertices are all distinct, and for 1≤i<l1\le i<l, there is an edge between viv_i and vi+1v_{i+1}. In particular, there is an edge between vlv_l and v1v_1.

You must ensure that among the 2n2^n vertices, each vertex belongs to exactly one simple cycle. You must ensure l≥3l\ge 3.

2
2 1
3 2
Yes
4 0 1 3 2
Yes
4 0 1 3 2
4 4 5 7 6

Hint

Test Point ID n≤n\le Special Property
1∼31\sim 3 33 None
4,54,5 1313 A
6∼86\sim 8 None
9,109,10 1717

Special property A: k=1k=1.

For all testdata, 1≤T≤101\le T\le 10, 1≤n≤171\le n\le 17, 1≤k≤2n1\le k \le 2^{n}.

Translated by ChatGPT 5