結果
問題 | No.326 あみだますたー |
ユーザー | lloyz |
提出日時 | 2023-10-16 00:05:42 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 358 ms |
コンパイル使用メモリ | 10,792 KB |
実行使用メモリ | 8,772 KB |
最終ジャッジ日時 | 2023-10-16 00:05:48 |
合計ジャッジ時間 | 4,808 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,772 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 17 ms
7,904 KB |
testcase_06 | AC | 28 ms
7,916 KB |
testcase_07 | AC | 21 ms
7,912 KB |
testcase_08 | AC | 25 ms
8,700 KB |
testcase_09 | AC | 39 ms
8,712 KB |
testcase_10 | AC | 36 ms
8,772 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
ソースコード
n = int(input()) A = [i + 1 for i in range(n)] m = int(input()) for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 A[a], A[b] = A[b], A[a] B = list(map(int, input().split())) ANS = [] for i in range(n): b = B[i] for j in range(i, n): a = A[j] if a == b: for k in range(j, i, -1): ANS.append((k, k + 1)) A[k - 1], A[k] = A[k], A[k - 1] print(len(ANS)) for a, b in ANS: print(a, b)