lamp can be coordinated to enlighten either a few lights to the left or a few lamps to the right. In the event that the I-th lamp is gone to one side, it enlightens all such lights j that j∈[i−pi,i−1]. Also, in case it is gone to one side, it enlightens all such lamps j that j∈[i+1,i+pi]. You will probably pick a course for every light so
Correct answer will be upvoted else downvoted. Computer science.
lamp can be coordinated to enlighten either a few lights to the left or a few lamps to the right. In the event that the I-th lamp is gone to one side, it enlightens all such lights j that j∈[i−pi,i−1]. Also, in case it is gone to one side, it enlightens all such lamps j that j∈[i+1,i+pi].
You will probably pick a course for every light so every lamp is enlightened by undoubtedly another lamp, or report that it is incomprehensible.
Input
The primary line contains one integer t (1≤t≤10000) — the number of experiments.
Each experiment comprises of two lines. The primary line contains one integer n (2≤n≤3⋅105) — the number of lamps.
The subsequent line contains n integers p1,p2,… ,pn (0≤pi≤n) — the force of the I-th lamp.
The amount of n over all experiments doesn't surpass 3⋅105.
Output
For each experiment, print the appropriate response as follows:
In case it is feasible to coordinate all lamps so every light is enlightened, print YES in the main line and a line of n characters L as well as R (the I-th character is L if the I-th lamp is gone to one side, in any case this character is R) in the subsequent line. In case there are numerous replies, you might print any of them.
In case there is no reply, just print NO for that experiment.
Step by step
Solved in 4 steps with 1 images