시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
0.05 초 | 1024 MB | 85 | 6 | 6 | 10.169% |
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:
The decisions of the rabbit are deterministic given its mood. In particular, the rabbit has the following two moods:
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.
번호 | 배점 | 제한 |
---|---|---|
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:
Here: $T = \frac{N(S+C)}{S+2\max{(S,C)}} + 3 \max{(S, C)}$.
12 2 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 |
2 | 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$.