結果

問題 No.326 あみだますたー
ユーザー JunOnumaJunOnuma
提出日時 2017-05-22 18:33:05
言語 Python2
(2.7.18)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 7,108 KB
実行使用メモリ 6,608 KB
最終ジャッジ日時 2023-10-19 14:09:41
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,408 KB
testcase_01 AC 12 ms
6,408 KB
testcase_02 AC 12 ms
6,408 KB
testcase_03 AC 31 ms
6,608 KB
testcase_04 AC 14 ms
6,420 KB
testcase_05 AC 11 ms
6,408 KB
testcase_06 AC 21 ms
6,516 KB
testcase_07 AC 15 ms
6,424 KB
testcase_08 AC 17 ms
6,444 KB
testcase_09 AC 30 ms
6,608 KB
testcase_10 AC 28 ms
6,572 KB
testcase_11 AC 11 ms
6,408 KB
testcase_12 AC 19 ms
6,476 KB
testcase_13 AC 25 ms
6,548 KB
testcase_14 AC 14 ms
6,408 KB
testcase_15 AC 18 ms
6,480 KB
testcase_16 AC 24 ms
6,568 KB
testcase_17 AC 16 ms
6,432 KB
testcase_18 AC 16 ms
6,432 KB
testcase_19 AC 21 ms
6,516 KB
testcase_20 AC 11 ms
6,408 KB
testcase_21 AC 11 ms
6,408 KB
testcase_22 AC 21 ms
6,504 KB
testcase_23 AC 19 ms
6,472 KB
testcase_24 AC 28 ms
6,588 KB
testcase_25 AC 25 ms
6,544 KB
testcase_26 AC 14 ms
6,408 KB
testcase_27 AC 23 ms
6,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
k = int(raw_input())
mv = []
for _ in range(k):
    x,_ = map(int, raw_input().split())
    mv.append(x)
l = map(int, raw_input().split())
for x in mv:
    t = l[x-1]
    l[x-1] = l[x]
    l[x] = t
ll = []
for p in range(1,n+1):
    q = l.index(p)
    for i in range(q,p-1,-1):
        ll.append(i)
        t = l[i]
        l[i] = l[i-1]
        l[i-1] = t
print len(ll)
for i in ll:
    print i,i+1
0