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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education