Two cells are adjoining in the event that they share a side. Thusly, every cell (x, y) has precisely three neighbors: (x+1, y) (x−1, y) (x+1, y−1) in case x is even and (x−1, y+1) in any case.
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
Two cells are adjoining in the event that they share a side. Thusly, every cell (x, y) has precisely three neighbors:
(x+1, y)
(x−1, y)
(x+1, y−1) in case x is even and (x−1, y+1) in any case.
At first a few cells are contaminated, all the others are sound. The course of recuperation starts. Each second, for precisely one cell (despite the fact that there may be different cells that could change its state) one of the accompanying occurs:
A sound cell with something like 2 contaminated neighbors likewise becomes tainted.
A contaminated cell with something like 2 solid neighbors likewise becomes sound.
In the event that no such cell exists, the course of recuperation stops. Patient is considered recuperated if the course of recuperation has halted and every one of the cells are solid.
We're keen on a most dire outcome imaginable: is it conceivable that the patient never recuperates, or on the other hand in case it's impractical, what is the greatest conceivable span of the recuperation interaction?
Input
The main line contains one integer n (1≤n≤250000) — the number of tainted cells.
The I-th of the following n lines contains two space-isolated integers xi and yi (0≤xi,yi<500), implying that cell (xi,yi) is tainted. All cells (xi,yi) are unmistakable, and any remaining cells are considered solid.
Output
In case it is conceivable that the creature never completely recuperates from the infection, print SICK. If not, you should print RECOVERED and in the following line an integer k — the longest conceivable recuperation time frame, modulo 998244353.
Step by step
Solved in 4 steps with 1 images