Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.013 s | 3 KBi |
#2 |
Incorrecto
|
0.01 s | 3 KBi |
#3 |
Incorrecto
|
0.01 s | 3 KBi |
#4 |
Incorrecto
|
0.018 s | 3 KBi |
#5 |
Incorrecto
|
0.009 s | 3 KBi |
#6 |
Incorrecto
|
0.01 s | 3 KBi |
#7 |
Incorrecto
|
0.01 s | 3 KBi |
#8 |
Incorrecto
|
0.01 s | 3 KBi |
#9 |
Incorrecto
|
0.011 s | 3 KBi |
#10 |
Incorrecto
|
0.019 s | 3 KBi |
#11 |
Incorrecto
|
0.012 s | 3 KBi |
#12 |
Incorrecto
|
0.254 s | 25 KBi |
#13 |
Incorrecto
|
0.731 s | 26 KBi |
#14 |
Incorrecto
|
0.255 s | 25 KBi |
#15 |
Incorrecto
|
0.249 s | 25 KBi |
#16 |
Incorrecto
|
0.694 s | 26 KBi |
#17 |
Incorrecto
|
0.246 s | 25 KBi |
#18 |
Incorrecto
|
0.681 s | 26 KBi |
#19 |
Incorrecto
|
0.238 s | 25 KBi |
#20 |
Incorrecto
|
0.196 s | 26 KBi |
def ancestor(arbol): print(arbol) c = int(input()) for i in range(c): flag = False nodos = input().split(' ') ancestor = nodos[0] child = nodos[1] if ancestor == child: print('Yes') continue parent = arbol[child] if parent == ancestor: print('Yes') else: print('No') def graph(N): arbol = {} for i in range(N-1): arbolData = input().split(' ') # 0 1 = 0 is parent and 1 is child arbol['0'] = "Raiz" arbol[arbolData[1]] = arbolData[0] # key=child and value=parent ancestor(arbol) n = int(input()) print(graph(n))