luogu#P5164. xtq的定向越野

xtq的定向越野

Background

xtq has an unusual talent for orienteering. In first grade, he won first place in the "Problem-Solving Cup" and also won the "Cricket Cup" "cricket". One day, he was studying a problem.

Problem Description

xtq wants to design a circular map, which can be seen as a circle. On the circumference, there are any number of non-overlapping checkpoints, and each checkpoint has some tasks.

Let all possible tasks form a kk-element set. Then this set has 2k2^k distinct subsets, denoted as A1,A2......A2kA_1,A_2......A_{2^k}. Each checkpoint has exactly one task subset among A1,A2......A2kA_1,A_2......A_{2^k}. Note that different checkpoints may have the same task subset.

xtq wants to satisfy the following conditions:

11: For any subsets AiAi, AjAj satisfying AiAj=1||Ai|-|Aj||=1, there exists exactly one pair of adjacent checkpoints whose task subsets are AiAi and AjAj.

22: For any adjacent checkpoints with subsets AiAi, AjAj, it always holds that AiAj=1||Ai|-|Aj||=1.

Now xtq gives you an nn, and he wants you to find all possible 2kn2\le k\le n such that there exists at least one way to place checkpoints and assign tasks.

In the above description, Ai|Ai| denotes the number of elements in Ai|Ai|, and a+b|a+b| denotes the absolute value of a+ba+b.

Input Format

One positive integer nn.

Output Format

Output several lines. Each line contains one positive integer, representing a possible kk, in increasing order.

3
2

Hint

[Sample Explanation]

When k=2k=2, suppose all possible tasks are {1,2}\{1,2\}. Then the 4 subsets of tasks are \emptyset, {1}\{1\}, {2}\{2\}, {1,2}\{1,2\}. The following figure shows one valid arrangement:

In the figure, {}\{\emptyset\} should be \emptyset (typo).

[Constraints]

For 50%50\% of the testdata, n5000n\le 5000.

For 100%100\% of the testdata, nn fits in the range of longlonglong long, and 2n2\le n.

Translated by ChatGPT 5