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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.027 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.022 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.021 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.027 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.025 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.06 s | 14 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.047 s | 14 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.024 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
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 26, in <module> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.027 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.024 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.042 s | 4 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.024 s | 4 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.023 s | 4 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.027 s | 4 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.027 s | 4 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.026 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.022 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.026 s | 7 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.073 s | 14 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.154 s | 17 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.086 s | 14 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.056 s | 14 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> print(" ".join(result(arr, K))) File "script.py", line 16, in result cycles = convert_to_disjoint_cycles(perm) File "script.py", line 12, in convert_to_disjoint_cycles res.append(cycle) NameError: name 'res' is not defined |
0.122 s | 16 KBi |
def convert_to_disjoint_cycles(perm): used = {} for i in range(len(perm)): if i in used: continue cycle = [i] used[i] = (cycle, 0) while perm[i] not in used: used[perm[i]] = (cycle, len(cycle)) cycle.append(perm[i]) i = perm[i] res.append(cycle) return used def result(perm, k): cycles = convert_to_disjoint_cycles(perm) res = [None for _ in range(len(perm))] for i in range(len(perm)): cyc, idx = cycles[i] j = (idx + (k % len(cyc))) % len(cyc) res[cyc[j]] = str(i + 1) return res N, K = map(int, input().split(" ")) arr = [int(i) for i in input().split(" ")] print(" ".join(result(arr, K)))