結果

問題 No.326 あみだますたー
ユーザー tabataba
提出日時 2016-04-14 22:52:09
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 7,068 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-04-15 01:34:12
合計ジャッジ時間 4,197 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,812 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 25 ms
6,944 KB
testcase_07 AC 16 ms
6,944 KB
testcase_08 AC 20 ms
6,940 KB
testcase_09 AC 36 ms
7,552 KB
testcase_10 AC 32 ms
7,296 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()
xy=[map(int,raw_input().split())for i in[k]*k]
a=map(int,raw_input().split())
b=range(1,n+1)
for i in xy:
	x=i[0]-1
	y=i[1]-1
	b[x],b[y]=b[y],b[x]
#print b
t=[]
for i in range(n):
	for j in range(n-1,i,-1):
		if b[j]==a[i]:
			b[j],b[j-1]=b[j-1],b[j]
			t+=[[j,j+1]]
#print a,b,a==b
print len(t)
for i in t:
	print i[0],i[1]
0