Answer in python , java c++ only. Correct code and output screenshot required. Else i would downvote. In this problem, There are 109+7 metropolitan networks coordinated in a circle in this settlement and none of them are related now. Elon Tusk needs to relate a part of those metropolitan networks using only roads of a comparable size to cut down the creation cost of those roads. Because
Answer in python , java c++ only. Correct code and output screenshot required. Else i would downvote.
In this problem, There are 109+7 metropolitan networks coordinated in a circle in this settlement and none of them are related now. Elon Tusk needs to relate a part of those metropolitan networks using only roads of a comparable size to cut down the creation cost of those roads. Because of that he gave a summary on N alludes to where a couple of alludes to can appear more than once and Q questions that you need to answer. For the inquiry you need to choose whether it is attainable to interface all of the metropolitan networks from Li to Ri on that summary using only roads of length Di.
Information
The chief line contains two numbers N and Q (1≤N,Q≤2⋅105 ) — the length of the assortment of metropolitan regions and the amount of requests you need to address.
The ensuing lines contains N numbers addressing the assortment of alludes to. Next Q lines contain three entire numbers L,R and D (1≤Li,Ri≤N, 0≤Di≤109+6) — the extent of metropolitan regions that ought to be related and the length of the road that you can use.
Yield
The yield contains Q lines. On the off chance that it is attainable to interface all of the metropolitan regions from the I-th request can be related with roads of length Di the I-th line should contain "Yes", some other way it should contain "No".
Step by step
Solved in 3 steps with 1 images