Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.02 s | 3 KBi |
#2 |
Incorrecto
|
0.01 s | 3 KBi |
#3 |
Incorrecto
|
0.017 s | 3 KBi |
#4 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 22, in <module> parent = arbol[child] KeyError: '0' |
0.018 s | 3 KBi |
#5 |
Incorrecto
|
0.012 s | 3 KBi |
#6 |
Incorrecto
|
0.013 s | 3 KBi |
#7 |
Incorrecto
|
0.01 s | 3 KBi |
#8 |
Incorrecto
|
0.014 s | 3 KBi |
#9 |
Incorrecto
|
0.014 s | 3 KBi |
#10 |
Incorrecto
|
0.01 s | 3 KBi |
#11 |
Incorrecto
|
0.011 s | 3 KBi |
#12 |
Incorrecto
|
0.172 s | 21 KBi |
#13 |
Incorrecto
|
0.441 s | 21 KBi |
#14 |
Incorrecto
|
0.168 s | 21 KBi |
#15 |
Incorrecto
|
0.481 s | 21 KBi |
#16 |
Incorrecto
|
0.159 s | 21 KBi |
#17 |
Incorrecto
|
0.155 s | 21 KBi |
#18 |
Incorrecto
|
0.467 s | 21 KBi |
#19 |
Incorrecto
|
0.157 s | 21 KBi |
#20 |
Incorrecto
|
0.129 s | 21 KBi |
N = int(input()) arbol = {} for i in range(N-1): arbolData = input().split() arbol['0'] = None arbol[arbolData[1]] = arbolData[0] c = int(input()) for i in range(c): wasYes = False query = input().split(' ') ancestor = query[0] child = query[1] if ancestor == child: print('Yes') parent = arbol[child] if parent is None: print('No') elif parent == ancestor: wasYes = True print('Yes')