{"problem":{"name":"XOR Matching","description":{"content":"Construct a sequence $a$ = {$a_1,\\ a_2,\\ ...,\\ a_{2^{M + 1}}$} of length $2^{M + 1}$ that satisfies the following conditions, if such a sequence exists. *   Each integer between $0$ and $2^M - 1$ (in","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc126_f"},"statements":[{"statement_type":"Markdown","content":"Construct a sequence $a$ = {$a_1,\\ a_2,\\ ...,\\ a_{2^{M + 1}}$} of length $2^{M + 1}$ that satisfies the following conditions, if such a sequence exists.\n\n*   Each integer between $0$ and $2^M - 1$ (inclusive) occurs twice in $a$.\n*   For any $i$ and $j$ $(i < j)$ such that $a_i = a_j$, the formula $a_i \\ xor \\ a_{i + 1} \\ xor \\ ... \\ xor \\ a_j = K$ holds.\n\nWhat is xor (bitwise exclusive or)?\n\nThe xor of integers $c_1, c_2, ..., c_n$ is defined as follows:\n\n*   When $c_1 \\ xor \\ c_2 \\ xor \\ ... \\ xor \\ c_n$ is written in base two, the digit in the $2^k$'s place ($k \\geq 0$) is $1$ if the number of integers among $c_1, c_2, ...c_m$ whose binary representations have $1$ in the $2^k$'s place is odd, and $0$ if that count is even.\n\nFor example, $3 \\ xor \\ 5 = 6$. (If we write it in base two: `011` $xor$ `101` $=$ `110`.)\n\n## Constraints\n\n*   All values in input are integers.\n*   $0 \\leq M \\leq 17$\n*   $0 \\leq K \\leq 10^9$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$M$ $K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc126_f","tags":[],"sample_group":[["1 0","0 0 1 1\n\nFor this case, there are multiple sequences that satisfy the condition.\nFor example, when $a$ = {$0, 0, 1, 1$}, there are two pairs $(i,\\ j)\\ (i < j)$ such that $a_i = a_j$: $(1, 2)$ and $(3, 4)$. Since $a_1 \\ xor \\ a_2 = 0$ and $a_3 \\ xor \\ a_4 = 0$, this sequence $a$ satisfies the condition."],["1 1","\\-1\n\nNo sequence satisfies the condition."],["5 58","\\-1\n\nNo sequence satisfies the condition."]],"created_at":"2026-03-03 11:01:14"}}