結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー H3PO4H3PO4
提出日時 2020-04-25 10:23:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 299 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 36,628 KB
最終ジャッジ日時 2023-08-06 16:03:46
合計ジャッジ時間 29,238 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
36,628 KB
testcase_01 AC 142 ms
29,532 KB
testcase_02 AC 146 ms
29,596 KB
testcase_03 AC 133 ms
29,648 KB
testcase_04 AC 135 ms
29,452 KB
testcase_05 AC 139 ms
29,584 KB
testcase_06 AC 134 ms
29,632 KB
testcase_07 AC 136 ms
29,484 KB
testcase_08 AC 137 ms
29,620 KB
testcase_09 AC 134 ms
29,480 KB
testcase_10 AC 136 ms
29,620 KB
testcase_11 AC 2,943 ms
29,604 KB
testcase_12 AC 3,011 ms
29,436 KB
testcase_13 AC 3,294 ms
29,456 KB
testcase_14 AC 4,224 ms
29,524 KB
testcase_15 AC 431 ms
29,572 KB
testcase_16 AC 469 ms
29,576 KB
testcase_17 AC 542 ms
29,496 KB
testcase_18 AC 621 ms
29,484 KB
testcase_19 AC 705 ms
29,608 KB
testcase_20 AC 162 ms
29,496 KB
testcase_21 AC 154 ms
29,560 KB
testcase_22 AC 1,006 ms
29,604 KB
testcase_23 AC 577 ms
29,640 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