#P7282. [COCI 2020/2021 #4] Hop
[COCI 2020/2021 #4] Hop
Description
There are lily pads, numbered from to in order. On the -th pad there is an integer , and the sequence is strictly increasing.
Three frogs arrive.
Every pair of lily pads with must be assigned to exactly one of frogs or .
If a pair is assigned to a frog and is divisible by (), then that frog can jump from pad to pad .
Find an assignment such that no frog can make more than consecutive jumps.
Input Format
The first line contains a positive integer , the number of lily pads.
The second line contains positive integers , the integers on the lily pads.
Output Format
Output lines. On line , output integers, where the -th integer on that line indicates which frog the pair is assigned to.
8
3 4 6 9 12 18 36 72
1
2 3
1 2 3
1 2 3 1
2 3 1 2 3
1 2 3 1 2 3
1 2 3 1 2 3 1
2
10 101
1
Hint
Explanation of Sample 1

Frogs are represented by blue, green, and red, respectively.
The blue frog can jump from to , then to , and then to . This frog can make only consecutive jumps.
The green frog can jump from to , and then to . This frog can make only consecutive jumps.
The red frog cannot jump from to , because is not divisible by .
Constraints
This problem uses bundled evaluation.
| Subtask | Points | Constraints and notes |
|---|---|---|
| None |
For of the testdata, , .
Scoring
In your output, if one frog can make consecutive jumps with , and no frog can make consecutive jumps, then the score for that test point is points, where:
$$f(k)=\dfrac{1}{10}· \begin{cases} 11-k & (4 \le k \le 5) \cr 8-\lfloor {\dfrac{k}{2}} \rfloor & (6 \le k \le 11) \cr 1 & (12 \le k \le 19) \cr 0 & (k \ge 20) \cr \end{cases}$$Here, is the total score of the corresponding subtask. The score of each subtask equals the minimum score among all test points in that subtask.
Because the scoring of this problem is special, a non-official self-written Special Judge is enabled. You can also download it from the attachments. Everyone is welcome to hack (you may send a private message or post directly).
Notes
The points of this problem follow the original COCI setting, with a full score of .
Translated from COCI2020-2021 CONTEST #4 T3 Hop.
Translated by ChatGPT 5
京公网安备 11011102002149号