結果
問題 |
No.101 ぐるぐる!あみだくじ!
|
ユーザー |
![]() |
提出日時 | 2016-05-12 15:46:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,696 KB |
最終ジャッジ日時 | 2024-10-05 13:58:29 |
合計ジャッジ時間 | 7,250 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 6 WA * 4 RE * 1 TLE * 1 -- * 25 |
ソースコード
N = int(input()) k = int(input()) K = tuple([tuple(map(int, input().split(' '))) for i in range(k)]) count = 0 l = [i for i in range(1, N + 1)] i = 0 while True: x, y = K[i] l[x - 1], l[y - 1] = l[y - 1], l[x - 1] i += 1 if i == k: count += 1 i = 0 for j, n in enumerate(l): if j + 1 != n: break else: break print(count)