All submissions for this problem are available.
So, the story goes like this. Remember Gagan is the hero.Being a hero , he always does crazy stuff and there is nobody to challenge him. But in our wonderland, there comes dj . Dj and Gagan were once great friends but now the everything has changed between them. In order to challenge Gagan's heroism , dj made a trap for gagan. Trap consist of several segments of electricty. In order to trap gagan , dj ensure that each circuit is fully connected and every machinery in a segment has electricity. But somehow dj's friend 'Akash' knows that gagan is the real hero. So, he locate Gagan via android device manager and tell him about the trap. Gagan is now fully aware of the trap and he now walks everywhere with a chainsaw to cut the wires and open the circuit. Dj on the other hand has completely setup his trap. Whole wonderland knows that gagan is big fan of beautiful girls and as usual he is watching birds.Dj somehow has spotted and trapped gagan.Before Gagan loses his heroism and fame in wonderland, he has q seconds to ask questions from you. As you were also there watching birds, you decide to help gagan. After each second , gagan asks you a question and you have to guide him.. Machines are numbered as 1 to n
- First line conatins two integer n and m where n denotes total number of machines in the whole trap while m denotes the total number of wirings between them.
- Next m line conatins two integer Ai and Bi , representing that a wire exists between the machines Ai and Bi.
- Next line conatins Q as described in the question.
- Next Q lines contains a single integer x , which means gagan is asking whether he would cut the wire between Ax and Bx or not.
For each of the Q questions, you have to tell him whether that cut would destroy the trap or not.If trap is destroyed then print 'Gagan Rocks' (without quotes) else print ' Dj Rocks' (without quotes).
- 1 <= n,m <= 100000
- 1 <= x <= m
- 1 <= Q <= 100000
- 1 <= Ai,Bi <= n
Input: 6 6 1 2 3 4 2 3 4 5 5 6 5 3 2 1 2
Output: Gagan Rocks Dj Rocks
Query 1: Index 1 denotes that wiring between 1 and 2 is cut , this would make the machinery 1 disconnected , hence "Gagan Rocks"
Query 2: Index 2 denotes that wiring between 3 and 4 is cut , this won't make any machinery disconnected as there is still a way 3 -5 -4 that connects 3-4 , hence "Dj Rocks
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, NODEJS, PERL, WSPC, BASH, JS, PERL6, TEXT|
Fetching successful submissions