My issue
My solution give the same result as sown in the problem statement then why its submission shows wrong Answer. Any one can help in it?
My code
import math
from collections import defaultdict
# cook your dish here
groups=int(input())
edges=int(input())
graph=defaultdict(list)
# print(graph)
for i in range(edges):
graph[i+1]=list(map(int,input().split()))
def fn(start,graph):
visit=set()
q=[start]
visit.add(start)
count=0
while q!=[]:
node=q.pop(0)
count+=len(graph)-len(visit)
if len(visit)==len(graph):
break
for i in graph[node]:
if len(visit)==len(graph):
break
# print(i)
if i not in visit:
visit.add(i)
q.append(i)
return count-1
ans=[]
for i in graph:
ans.append([fn(i,graph),i])
ans.sort()
inputno=ans[0][0]/len(graph)
rounded = round(inputno, 6)
print(ans[0][1],rounded)
Problem Link:LOKBIL Problem - CodeChef