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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.024 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.023 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) NameError: name 's' is not defined |
0.025 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.032 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.026 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.024 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.026 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.03 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.03 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.026 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.023 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 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.033 s | 3 KBi |
#13 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#14 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#15 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.032 s | 3 KBi |
#16 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.024 s | 3 KBi |
#17 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.027 s | 3 KBi |
#18 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.024 s | 3 KBi |
#19 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.029 s | 3 KBi |
#20 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.023 s | 3 KBi |
#21 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.023 s | 3 KBi |
#22 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.034 s | 3 KBi |
#23 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#24 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.023 s | 3 KBi |
#25 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#26 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.031 s | 3 KBi |
#27 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.241 s | 11 KBi |
#28 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#29 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.294 s | 11 KBi |
#30 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.025 s | 3 KBi |
#31 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.044 s | 5 KBi |
#32 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.209 s | 12 KBi |
#33 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.062 s | 6 KBi |
#34 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.066 s | 6 KBi |
#35 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 26, in <module> if has_cycles(N): File "script.py", line 7, in has_cycles if dfs(i): File "script.py", line 12, in dfs s.add(node) AttributeError: 'str' object has no attribute 'add' |
0.221 s | 12 KBi |
from collections import defaultdict def has_cycles(n): s = set() for i in range(n): if i not in s: if dfs(i): return True return False def dfs(node): s.add(node) for nn in g[node]: if nn in s: return True if dfs(nn): return True return False N, M = map(int, input().split(" ")) g = defaultdict(list) for _ in range(M): s, t = input().split(" ") g[s].append(t) g[t].append(s) if has_cycles(N): print("Yes") else: print("No")