There are 109+7 urban communities orchestrated in a circle in this settlement and none of them are associated at this point. Elon Tusk needs to associate a portion of those urban communities utilizing just streets of a similar
Answer in c++. Correct code and output screenshot required. Else i would downvote.
There are 109+7 urban communities orchestrated in a circle in this settlement and none of them are associated at this point. Elon Tusk needs to associate a portion of those urban communities utilizing just streets of a similar size to bring down the creation cost of those streets. On account of that he gave a rundown on N refers to where a few refers to can show up more than once and Q questions that you need to reply. For the question you need to decide whether it is feasible to interface every one of the urban communities from Li to Ri on that rundown utilizing just streets of length Di.
Info input: The principal line contains two numbers N and Q (1≤N,Q≤2⋅105 ) — the length of the variety of urban areas and the quantity of inquiries you need to address.
The subsequent lines contains N numbers addressing the variety of refers to. Next Q lines contain three whole numbers L,R and D (1≤Li,Ri≤N, 0≤Di≤109+6) — the scope of urban areas that should be associated and the length of the street that you can utilize.
Yield :The yield contains Q lines. In case it is feasible to interface every one of the urban areas from the I-th inquiry can be associated with streets of length Di the I-th line ought to contain "Yes", any other way it ought to contain "No".
Step by step
Solved in 3 steps with 1 images