ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1837. Isenbaev's Number

Why Restricted Function ???????????!!!!!!!!!!!!!!!!!!!!!
Posted by Ramkrushna Pradhan 25 Jan 2015 22:33
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 ???????????!!!!!!!!!!!!!!!!!!!!!
Posted by VadimBan 20 Aug 2023 18:31
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