Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.011 s | 3 KBi |
#2 |
Incorrecto
|
0.012 s | 3 KBi |
#3 |
Incorrecto
|
0.011 s | 3 KBi |
#4 |
Incorrecto
|
0.01 s | 3 KBi |
#5 |
Incorrecto
|
0.01 s | 3 KBi |
#6 |
Incorrecto
|
0.01 s | 3 KBi |
#7 |
Incorrecto
|
0.011 s | 3 KBi |
#8 |
Incorrecto
|
0.024 s | 3 KBi |
#9 |
Incorrecto
|
0.03 s | 3 KBi |
#10 |
Incorrecto
|
0.01 s | 3 KBi |
#11 |
Incorrecto
|
0.011 s | 3 KBi |
#12 |
Incorrecto
|
0.209 s | 26 KBi |
#13 |
Incorrecto
|
0.253 s | 25 KBi |
#14 |
Incorrecto
|
0.26 s | 25 KBi |
#15 |
Incorrecto
|
0.248 s | 25 KBi |
#16 |
Incorrecto
|
0.227 s | 26 KBi |
#17 |
Incorrecto
|
0.715 s | 26 KBi |
#18 |
Incorrecto
|
0.247 s | 25 KBi |
#19 |
Incorrecto
|
0.252 s | 25 KBi |
#20 |
Incorrecto
|
0.22 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'] = None arbol[arbolData[1]] = arbolData[0] # key=child and value=parent ancestor(arbol) n = int(input()) print(graph(n))