█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 6366

Problema 0x1c - Decir si un nodo es ancestro de otro en un árbol

  • Autor: Jorgito
  • Fecha: 2022-06-27 17:23:26 UTC (Hace casi 2 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.012 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.017 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.038 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 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.01 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.019 s 3 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.032 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.01 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.02 s 3 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.021 s 3 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.022 s 3 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.043 s 3 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.118 s 21 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.413 s 21 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.471 s 21 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.167 s 21 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.49 s 21 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.112 s 21 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.111 s 21 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.12 s 21 KBi
#20
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 12, in <module>
    for key, value in three.items:
TypeError: 'builtin_function_or_method' object is not iterable
0.124 s 21 KBi
Puntos totales: 0 / 100

Código

N = int(input())

three = {}

for i in range(N-1):
    elements = input().split()
    parent = elements[0]
    child = elements[1]
    three[child] = parent

for key, value in three.items:
    know = input().split() # {"2":1}  [2, 1]
    father = know[0]
    child = know[1]
    
    if father == child:
        print('YES')
    
    parent = three[child] # we return the value, that means the parent
    while parent is not None:
        if parent == father:
            print("Yes")