結果
問題 |
No.326 あみだますたー
|
ユーザー |
![]() |
提出日時 | 2017-01-04 11:04:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 408 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-12-16 11:06:08 |
合計ジャッジ時間 | 5,521 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | AC * 7 WA * 19 |
ソースコード
i = input n = int(i()) now = list(range(1, n+1)) k = int(i()) for _ in range(k): x, y = map(int, i().split()) now[x-1], now[y-1] = now[y-1], now[x-1] A = list(map(int, i().split())) ans = list() for i, elm in enumerate(A): if now[i] == elm: continue j = now.index(elm) while j != i: ans.append( (j, j+1) ) now[j-1], now[j] = now[j], now[j-1] j -= 1 print(len(ans)) for x, y in ans: print(x, y)