#P11192. [COTS 2021] 菜 Jelo

    ID: 12353 远端评测题 10000ms 2048MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2021提交答案Special JudgeO2优化群论线性代数位运算构造COCI(克罗地亚)

[COTS 2021] 菜 Jelo

Background

Translated from Izborne Pripreme 2021 (Croatian IOI/CEOI Team Selection) D1T1。1s,0.5G\texttt{1s,0.5G}

Due to the special SPJ of this problem, the TL and ML of this problem are changed to 10s,2G\texttt{10s,2G} respectively. However, for contestants' programs, the time and memory limits are the same as in the original problem.

If you upload your answer using a zip package, name the files as jelo-1.outjelo-5.out\texttt{jelo-1.out}\sim \texttt{jelo-5.out} respectively.

Problem Description

Given a positive even integer NN, construct a largest possible set S{0,1,,2N1}S\subseteq \{0,1,\cdots,2^{N}-1\} such that $\left|\bigcup_{i,j\in S,i\lt j} \{i\oplus j\}\right|={|S|\choose 2}$。In other words, for any two chosen pairs (a,b),(c,d)(a,b),(c,d) in SS (a,b,c,dSa,b,c,d\in S, a<ba\lt b, c<dc\lt d, (a,b)(c,d)(a,b)\neq (c,d)), it holds that abcda\oplus b\neq c\oplus d.

Here, \oplus denotes the bitwise XOR operation.

Input Format

One line containing a positive integer NN.

Output Format

The first line contains an integer S|S|.

Then output S|S| numbers describing SS.

4
6
0 1 2 4 8 15

Hint

For 100%100\% of the testdata, it is guaranteed that 1N301\le N\le 30.

This problem has 55 test points. Each test point has three scoring parameters t1,t2,t3t_1,t_2,t_3. Let t=St=|S|. The score is computed as:

$$\mathrm{score}(t)= \begin{cases} 2.4\cdot \frac{t}{t_1} & t\in [0,t_1) \\ 2.4+3.6\cdot \frac{t-t_1}{t_2-t_1} & t\in [t_1,t_2) \\ 6+12\cdot \frac{t-t_2}{t_3-t_2} & t\in [t_2,t_3) \\ 20 & t\in [t_3,2^N] \\ \end{cases}$$
Test Point ID N=N= t1=t_1= t2=t_2= t3=t_3= Score
1 1 18 18 267 267 283 283 512 512 20 20
2 2 20 20 444 444 462 462 1024 1024
3 3 26 26 2019 2019 2040 2040 8192 8192
4 4 28 28 3295 3295 3327 3327 16384 16384
5 5 30 30 5377 5377 5430 5430 32768 32768

[Hint] Please pay attention to the code length limit.

Translated by ChatGPT 5