Rezultati

Up. imeNalogaJezikRezultatČas oddaje
ognjeniprocesor-2018 Nič nas ne sme presenetiti! Python 3 0/100Prekoračen čas (TLE) 19. apr '18 @ 18:47

Test Točke Porabljen spomin Porabljen čas Status
#1 12/12 8,582 MiB 0,000 s OK
#2 12/12 8,664 MiB 0,000 s OK
#3 12/12 8,566 MiB 0,000 s OK
#4 0/12 38,234 MiB 3,222 s Prekoračen čas
#5 13/13 8,504 MiB 0,000 s OK
#6 0/13 28,434 MiB 3,279 s Prekoračen čas
#7 0/13 27,895 MiB 3,310 s Prekoračen čas
#8 0/13 28,488 MiB 3,208 s Prekoračen čas

Ocenjevani program (nnnp.py):
n, q = [int(x) for x in input().split()]
visited = [False for _ in range(n)]


def dfs(graph, x, upor):
    visited[x] = True
    for n in graph[x]:
        if n in upor and not visited[n]:
            dfs(graph, n, upor)

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

for j in range(q):
    m, uporniki = input().split(maxsplit=1)
    uporniki = [int(x)-1 for x in uporniki.split()]
    dfs(G, uporniki[0], uporniki)
    for y in uporniki:
        if not visited[y]:
            print('NASLEDNJI')
            break
    else:
        print('ALAAAARHM')
    visited = [False for _ in range(n)]