King Robert and his Queries
CodeChefOpen on judge ↗
Robert Baratheon, King of the Seven Kingdom of Westeros found that his kingdom is divided into N*M blocks . He wants to join the kingdom by joining a few of the blocks with roads or aerial ways. He gives you two types of queries 1. x1 y1 x2 y2 - Connect blocks (x1,y1) and (x2,y2) 2. x1 y1 x2 y2 - Ask if a person can reach from (x1,y1) to (x2,y2) Input The first line of input will consists of t
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start