結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー H3PO4H3PO4
提出日時 2020-04-25 10:23:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 299 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,580 KB
最終ジャッジ日時 2024-04-24 11:22:52
合計ジャッジ時間 37,692 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 451 ms
44,320 KB
testcase_01 AC 471 ms
43,948 KB
testcase_02 AC 454 ms
44,208 KB
testcase_03 AC 468 ms
44,200 KB
testcase_04 AC 458 ms
44,328 KB
testcase_05 AC 465 ms
44,192 KB
testcase_06 AC 446 ms
44,580 KB
testcase_07 AC 450 ms
43,944 KB
testcase_08 AC 454 ms
44,200 KB
testcase_09 AC 449 ms
44,200 KB
testcase_10 AC 450 ms
44,196 KB
testcase_11 AC 3,352 ms
44,456 KB
testcase_12 AC 3,453 ms
44,068 KB
testcase_13 AC 3,599 ms
44,064 KB
testcase_14 AC 4,715 ms
43,944 KB
testcase_15 AC 760 ms
43,976 KB
testcase_16 AC 787 ms
44,452 KB
testcase_17 AC 839 ms
43,948 KB
testcase_18 AC 968 ms
44,580 KB
testcase_19 AC 1,000 ms
44,196 KB
testcase_20 AC 478 ms
44,208 KB
testcase_21 AC 474 ms
43,940 KB
testcase_22 AC 1,311 ms
44,324 KB
testcase_23 AC 896 ms
44,448 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

int1 = lambda x: int(x) - 1

N = int(input())
K = int(input())
F = np.arange(N)
A = np.arange(N)
for _ in range(K):
    x, y = map(int1, input().split())
    F[x], F[y] = F[y], F[x]
F_tmp = F.copy()

ans = 1
while (F_tmp != A).any():
    F_tmp = F_tmp[F]
    ans += 1
print(ans)
0