結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー vorg101
提出日時 2016-05-12 15:52:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 340 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,572 KB
最終ジャッジ日時 2024-10-05 13:58:41
合計ジャッジ時間 7,036 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 11 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
K = tuple([tuple(map(int, input().split(' '))) for i in range(int(input()))])
count = 0
l = [i for i in range(1, N + 1)]
while True:
    for x, y in K:
        l[x - 1], l[y - 1] = l[y - 1], l[x - 1]
    count += 1
    for j, n in enumerate(l):
        if j + 1 != n:
            break
    else:
        break

print(count)
0