結果

問題 No.326 あみだますたー
ユーザー tjaketjake
提出日時 2015-12-19 00:16:23
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 6,776 KB
実行使用メモリ 6,724 KB
最終ジャッジ日時 2023-10-14 14:08:36
合計ジャッジ時間 3,909 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,052 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 12 ms
6,060 KB
testcase_06 AC 19 ms
6,060 KB
testcase_07 AC 18 ms
5,964 KB
testcase_08 AC 18 ms
6,616 KB
testcase_09 AC 29 ms
6,492 KB
testcase_10 AC 28 ms
6,724 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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
k = input()

inputs = lambda:map(int, raw_input().split())
st = range(1,n+1)
for i in xrange(k):
    x, y = inputs()
    y-=2
    st[x], st[y] = st[y], st[x]
a = inputs()
b = [a.index(e) for e in st]
ans = []
for i in xrange(n):
    for j in xrange(n-1):
        if b[j]>b[j+1]:
            b[j],b[j+1]=b[j+1],b[j]
            ans.append((j+1, j+2))
print len(ans)
print "\n".join("%d %d" % e for e in ans)
0