結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー roiti46roiti46
提出日時 2015-02-18 04:42:18
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 255 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 10,384 KB
最終ジャッジ日時 2023-09-06 01:58:59
合計ジャッジ時間 7,468 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,940 KB
testcase_01 AC 14 ms
6,124 KB
testcase_02 AC 13 ms
6,140 KB
testcase_03 AC 12 ms
5,864 KB
testcase_04 AC 12 ms
5,896 KB
testcase_05 AC 14 ms
6,096 KB
testcase_06 AC 12 ms
5,876 KB
testcase_07 AC 13 ms
5,952 KB
testcase_08 AC 13 ms
6,100 KB
testcase_09 AC 13 ms
5,892 KB
testcase_10 AC 13 ms
5,936 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 #

N = int(raw_input())
K = int(raw_input())
s = range(N)
for loop in xrange(K):
    X,Y = map(int,raw_input().split())
    X -= 1; Y -= 1
    s[X],s[Y] = s[Y],s[X]

a = s[:]
ans = 1
while a != range(N):
    a = [a[i] for i in s]
    ans += 1
print ans
    
0