結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー sawa_tsukasawa_tsuka
提出日時 2017-07-25 16:18:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 51,408 KB
最終ジャッジ日時 2024-04-17 23:23:31
合計ジャッジ時間 13,130 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 528 ms
44,300 KB
testcase_01 AC 525 ms
44,076 KB
testcase_02 AC 532 ms
43,952 KB
testcase_03 AC 541 ms
44,344 KB
testcase_04 AC 510 ms
44,340 KB
testcase_05 AC 510 ms
43,952 KB
testcase_06 AC 466 ms
44,076 KB
testcase_07 AC 463 ms
44,204 KB
testcase_08 AC 472 ms
44,340 KB
testcase_09 AC 490 ms
44,332 KB
testcase_10 AC 484 ms
43,956 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
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 #

# coding: utf-8
import numpy as np
n=int(input())
a=[i for i in range(n+1)]
for i in range(int(input())):
    tx,ty=map(int,input().split())
    a[tx],a[ty]=a[ty],a[tx]
ar=np.zeros((n,n))
for i in range(n):
    ar[i][a[i+1]-1]=1
I=p=np.identity(n)
for i in range(1,1000000000):
    p=p@ar
    if np.allclose(p,I)==True:
        print(i)
        break;
0