結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー warashiwarashi
提出日時 2015-02-11 18:58:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 495 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 8,816 KB
最終ジャッジ日時 2023-09-05 23:40:13
合計ジャッジ時間 28,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,616 KB
testcase_01 AC 23 ms
8,684 KB
testcase_02 AC 24 ms
8,716 KB
testcase_03 AC 21 ms
8,640 KB
testcase_04 AC 21 ms
8,656 KB
testcase_05 AC 24 ms
8,656 KB
testcase_06 AC 22 ms
8,624 KB
testcase_07 AC 23 ms
8,668 KB
testcase_08 AC 23 ms
8,748 KB
testcase_09 AC 23 ms
8,756 KB
testcase_10 AC 23 ms
8,624 KB
testcase_11 AC 3,540 ms
8,656 KB
testcase_12 AC 3,707 ms
8,784 KB
testcase_13 AC 3,536 ms
8,728 KB
testcase_14 TLE -
testcase_15 AC 365 ms
8,692 KB
testcase_16 AC 436 ms
8,816 KB
testcase_17 AC 492 ms
8,672 KB
testcase_18 AC 631 ms
8,684 KB
testcase_19 AC 733 ms
8,656 KB
testcase_20 AC 50 ms
8,760 KB
testcase_21 AC 42 ms
8,792 KB
testcase_22 AC 1,087 ms
8,668 KB
testcase_23 AC 589 ms
8,692 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 #

#!/usr/bin/env python3
from functools import reduce


def swap(l, i):
    l[i[0] - 1], l[i[1] - 1] = l[i[1] - 1], l[i[0] - 1]
    return l


def shufle(bars, l):
    return [bars[x] for x in l]

N = int(input())
K = int(input())
initial = list(range(N))
bar = [()] * K
for i in range(K):
    bar[i] = tuple(map(int, input().split()))

bars = list(reduce(swap, bar, list(initial)))
l = shufle(bars, list(initial))
count = 1
while l != initial:
    l = shufle(bars, l)
    count += 1
print(count)
0