|  | 
|  | 
| back to board | Why Restricted Function ???????????!!!!!!!!!!!!!!!!!!!!! This codes gives correct output in my system but submitting it shows Restricted Function.Plz help...
 **************************************
 import Queue
 graph={}
 dic={}
 to_explore=Queue.Queue()
 def BFS(root):
 dic[root]=0
 to_explore.put(root)
 while not to_explore.empty():
 tmp=to_explore.get()
 for i in graph[tmp]:
 if i not in dic:
 dic[i]=dic[tmp]+1
 to_explore.put(i)
 n=input()
 while n:
 s=raw_input().split()
 for i in s:
 if i not in graph:
 graph[i]=[]
 for j in s:
 if j!=i:
 if j not in graph[i]:
 graph[i].append(j)
 else:
 for j in s:
 if j!=i:
 if j not in graph[i]:
 graph[i].append(j)
 n-=1
 if 'Isenbaev' in graph:
 BFS('Isenbaev')
 for i in graph:
 if i not in dic:
 dic[i]='undefined'
 for i in sorted(dic):
 print i,dic[i]
 else:
 for i in sorted(graph):
 print i,"undefined"
Re: Why Restricted Function ???????????!!!!!!!!!!!!!!!!!!!!! Don`t the queue module starts with lowercase letter?Looks like: from queue(module) import Queue(function)
 Actually, I have pretty similar code and always have runtime error on the very first test
 
 Edited by author 20.08.2023 18:32
 
 Edited by author 20.08.2023 18:32
 | 
 | 
|