CF1748F Circular Xor Reversal

题目描述

给定整数 $n$。 初始,有一个编号从 $0$ 开始的长度为 $n$ 的环形序列 $a$,满足 $a_i=2^i$ 对任意整数 $i(0\leq i

输入格式

输入一行一个整数 $n(2\leq n\leq 400)$。

输出格式

首先输出一行一个整数 $k(0\leq k\leq2.5\times10^5)$ 表示你所构造的操作方案的操作次数。 接下来输出一行 $k$ 个整数表示你每次操作所选择的 $i(1\leq i\leq n)$。 你并不需要最小化操作次数,只需构造任意一组满足要求的操作方案即可。 ### 样例解释 - 对于样例一: - 初始 $a$ 为 $[1,2]$。 - 第一次操作选择 $i=1$,操作后 $a$ 为 $[1,3]$。 - 第二次操作选择 $i=0$,操作后 $a$ 为 $[2,3]$。 - 第三次操作选择 $i=1$,操作后 $a$ 为 $[2,1]$,此时目标达成。 - 对于样例二: - 下面展示了样例输出对应的流程: $[1,2,4]\rightarrow[1,6,4]\rightarrow[7,6,4]\rightarrow[7,2,4]\rightarrow[5,2,4]\rightarrow[5,2,1]\rightarrow[5,3,1]\rightarrow[6,3,1]\rightarrow[6,2,1]\rightarrow[4,2,1]$。

说明/提示

In the notes, the elements on which the operations are performed are colored red. In the first test case, array $ a $ will change in the following way: $ [1,\color{red}{2}] \rightarrow [\color{red}{1},3] \rightarrow [2,\color{red}{3}] \rightarrow [2,1] $ . In the second test case, array $ a $ will change in the following way: $ [1,\color{red}{2},4] \rightarrow [\color{red}{1},6,4] \rightarrow [7,\color{red}{6},4] \rightarrow [\color{red}{7},2,4] \rightarrow [5,2,\color{red}{4}] \rightarrow [5,\color{red}{2},1] \rightarrow [\color{red}{5},3,1] \rightarrow [6,\color{red}{3},1] \rightarrow [\color{red}{6},2,1] \rightarrow [4,2,1] $ .