Problem Link :Author: Amrutansu Garanaik , Abhishek Patnaik Difficulty :Easy PrerequisiteGraph theoryProblem :Given a set of cities and bidirectional roads connecting them. Is it possible to travel through all roads exactly once and come back to the starting point?ExplanationThe problem asks whether there exists an Eulerian circuit in a graph or not. If so, it is possible to traverse all the edges exactly once and come back to starting node. A graph has a Eulerarian circuit if each vertices have even degrees. So, we just have to store the degrees of each node (here the cities) and count whether there is a node with odd degree. If so, print “NO” , otherwise “YES”. Check setter solution for implementation. N.B. The test cases were a bit weak, so some wrong answers also passed the test cases. We are sorry for that. But if your answer gave WA, then it means your answer is definitely wrong. For AC however, it might or might not be wrong.
This question is marked "community wiki".
asked 03 Apr '15, 20:41

@dragonemperor For euler circuit to exist . The graph should be connected right .? But I got AC by just checking the even degree of every node answered 04 Apr '15, 16:52
Yes, you are right. For our test cases, we created some graphs using pen and paper and used them to create the test files. Unfortunately all the graphs were connected. Also some wrong answers were accepted because of that.
(06 Apr '15, 00:28)
