Rezultati

Up. imeNalogaJezikRezultatČas oddaje
jayzcrew-2018 Nič nas ne sme presenetiti! Python 3 0/100Napaka med izvajanjem / ob izhodu (RTE) 19. apr '18 @ 17:11

Test Točke Porabljen spomin Porabljen čas Status
#1 12/12 8,500 MiB 0,000 s OK
#2 0/12 8,656 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 40, in <module>
    res = DFS(graf,grupa,size,primer[1])
  File "source.py3", line 17, in DFS
    explore(root)
  File "source.py3", line 9, in explore
    visited[v] = True
IndexError: list assignment index out of range
#3 0/12 8,496 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 40, in <module>
    res = DFS(graf,grupa,size,primer[1])
  File "source.py3", line 17, in DFS
    explore(root)
  File "source.py3", line 9, in explore
    visited[v] = True
IndexError: list assignment index out of range
#4 0/12 40,387 MiB 0,905 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 40, in <module>
    res = DFS(graf,grupa,size,primer[1])
  File "source.py3", line 17, in DFS
    explore(root)
  File "source.py3", line 9, in explore
    visited[v] = True
IndexError: list assignment index out of range
#5 0/13 8,680 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 40, in <module>
    res = DFS(graf,grupa,size,primer[1])
  File "source.py3", line 17, in DFS
    explore(root)
  File "source.py3", line 9, in explore
    visited[v] = True
IndexError: list assignment index out of range
#6 0/13 98,137 MiB 5,365 s Prekoračen čas
#7 0/13 98,168 MiB 6,458 s Prekoračen čas
#8 0/13 94,863 MiB 5,616 s Prekoračen čas

Ocenjevani program (nnnp.py):


def DFS(graf,grupa,size,zacetek):
    visited = [False] * len(graf)
    kolk = [0]

    def explore(v):
        visited[v] = True
        kolk[0] += 1
        for i in graf[v]:
            if i in grupa and visited[i] == False:
                explore(i)

    root = zacetek

    explore(root)

    return kolk[0] == size






n,q = input().strip().split()
n,q = int(n),int(q)
graf = [[] for i in range(n)]
for _ in range(n-1):
    a, b = input().strip().split()
    a, b = int(a)-1, int(b)-1
    graf[a].append(b)
    graf[b].append(a)

for _ in range(q):
    primer = list(map(int,input().strip().split()))
    size = primer[0]
    grupa = set(i-1 for i in primer[1:])

    res = DFS(graf,grupa,size,primer[1])
    if res:
        print("ALAAAARHM")
    else:
        print("NASLEDNJI")