結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 523 ms
44,076 KB
testcase_01 AC 518 ms
44,204 KB
testcase_02 AC 548 ms
43,952 KB
testcase_03 AC 563 ms
44,584 KB
testcase_04 AC 553 ms
44,592 KB
testcase_05 AC 548 ms
44,344 KB
testcase_06 AC 546 ms
44,208 KB
testcase_07 AC 554 ms
44,340 KB
testcase_08 AC 558 ms
44,200 KB
testcase_09 AC 562 ms
44,200 KB
testcase_10 AC 560 ms
44,588 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 513 ms
44,588 KB
testcase_35 AC 518 ms
44,344 KB
testcase_36 AC 522 ms
44,468 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

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,1001):
    p=p@ar
    if np.allclose(p,I)==True:
        print(i)
        break;
0