시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.05 초 1024 MB0000.000%

문제

The Mad Hatter just lost his favorite rabbit (The White Rabbit, of course) somewhere in a sequence of $N$ cells and is trying to find it. The cells are numbered with the integers $1$ to $N$. In the beginning the rabbit is in a single unknown cell in the sequence and every second of The Hatter’s search proceeds as follows:

  1. First, he chooses a single cell from the sequence and checks it. We’ll call this cell the checked cell. If the rabbit is there, the search ends.
  2. Afterwards, the rabbit chooses to either stay in the same cell, or to hop to a neighbouring cell (i.e. one cell leftwards or one cell rightwards). Note that it is possible for the rabbit to hop in the checked cell, if it’s a neighbouring one; that does not end the search!

The decisions of the rabbit are deterministic given its mood. In particular, the rabbit has the following two moods:

  1. Scared mood – when the rabbit is in this mood, it moves further away from the checked cell. If it cannot move further away (i.e. it is in cell $1$ or $N$), it stays in the same cell.
  2. Curious mood – when the rabbit is in this mood, it moves closer to the checked cell. Note that it is always possible for the rabbit to move closer.

Note that the rabbit only acts according to the last checked cell and does not care about previous checked cells.

Since this is The Hatter’s favorite rabbit, he knows its mood very well. In particular, he knows that the rabbit alternates between exactly $S$ seconds of scared mood and $C$ seconds of curious mood. For example, if $S = 2$ and $C = 1$, the mood of the rabbit would be the sequence [scared, scared, curious, scared, scared, curious … ].

The Hatter is very worried about his rabbit and asks you to write a program that computes a sequence of cells to check, such that the rabbit, regardless of its initial position, is guaranteed to be found.

입력

From the first line of the standard input, your program should read three integers: $N$, $S$ and $C$, describing the number of cells and the behavior of the rabbit.

출력

On the first line of the standard output your program should print $K$, the number of seconds your search sequence takes. On the second line your program should print $K$ integers in the range [$1$, $N$], listing the cells checked in each second. Note that this sequence is allowed to have repeats.

제한

  • $2 ≤ N ≤ 10^4$
  • $0 ≤ S, C ≤ 50$

서브태스크

번호 배점 제한
1 8

$S = 0$, $C = 1$

2 12

$S = 1$, $C = 0$

3 8

$S = 1$, $C = 1$

4 72

No additional constaints.

Let $K$ be the number of seconds in your search sequence. If you attempt to check an invalid cell (i.e. outside of the range [$1$, $N$]), or if your check sequence doesn’t always find the rabbit, you will receive $0$ points for the test case and a Wrong Answer verdict. Otherwise, if a test gives $R$ points, you will receive $pR$ points where:

  • $p = 0$, if $K > 2N$
  • $p = 1$, if $K ≤ T$
  • $p = 0.3\left( \frac{T}{K} \right)^2$, otherwise

Here: $T = \frac{N(S+C)}{S+2\max{(S,C)}} + 3 \max{(S, C)}$.

예제 입력 1

12 2 1

예제 출력 1

14
2 5 3 2 6 1 2 11 12 12 8 10 12 6

힌트

One can test that regardless of the starting position, this sequence always finds the rabbit. For example, consider the case where the rabbit starts in cell $8$. The search would proceed as follows:

Second Checked Cell Rabbit Mood (Before Moving) Rabbit Move
1 2 Scared 8 → 9
5 Scared 9 → 10
3 3 Curious 10 → 9
4 2 Scared 10 → 11
5 6 Scared 11 → 12
6 1 Curious 12 → 11
7 2 Scared 11 → 12
8 11 Scared 12 → 12
9 12 Curious Found

For this solution we have $K > T$, since $K = 14$ and $T = 12$. Thus, the part of the points received for this test is $p ≈ 0.22$.

채점 및 기타 정보

  • 예제는 채점하지 않는다.