Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.01 s | 3 KBi |
#2 |
Incorrecto
|
0.01 s | 3 KBi |
#3 |
Incorrecto
|
0.024 s | 3 KBi |
#4 |
Incorrecto
|
0.021 s | 3 KBi |
#5 |
Incorrecto
|
0.013 s | 3 KBi |
#6 |
Incorrecto
|
0.01 s | 3 KBi |
#7 |
Incorrecto
|
0.015 s | 3 KBi |
#8 |
Incorrecto
|
0.018 s | 3 KBi |
#9 |
Incorrecto
|
0.01 s | 3 KBi |
#10 |
Incorrecto
|
0.017 s | 3 KBi |
#11 |
Incorrecto
|
0.015 s | 3 KBi |
#12 |
Incorrecto
|
0.254 s | 25 KBi |
#13 |
Incorrecto
|
0.258 s | 25 KBi |
#14 |
Incorrecto
|
0.717 s | 26 KBi |
#15 |
Incorrecto
|
0.249 s | 25 KBi |
#16 |
Incorrecto
|
0.24 s | 25 KBi |
#17 |
Incorrecto
|
0.242 s | 25 KBi |
#18 |
Incorrecto
|
0.241 s | 25 KBi |
#19 |
Incorrecto
|
0.246 s | 25 KBi |
#20 |
Incorrecto
|
0.255 s | 25 KBi |
def ancestor(arbol): print(arbol) c = int(input()) for i in range(c): 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) if __name__== '__main__': n = int(input()) print(graph(n))