結果
問題 | No.326 あみだますたー |
ユーザー |
![]() |
提出日時 | 2025-02-04 21:21:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 463 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2025-02-04 21:21:33 |
合計ジャッジ時間 | 3,613 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
N = int(input()) K = int(input()) XY = [list(map(int,input().split())) for _ in range(K)] A = list(map(int,input().split())) for x,y in XY: x -= 1 y -= 1 A[x],A[y] = A[y],A[x] ans = [] for i in range(1,N+1): x = A.index(i) while x >= i: A[x-1],A[x] = A[x],A[x-1] ans.append((x,x + 1)) x -= 1 print(len(ans)) for a in ans: print(*a)