結果

問題 No.429 CupShuffle
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-16 17:29:17
言語 Ruby
(3.3.0)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 11,432 KB
実行使用メモリ 27,936 KB
最終ジャッジ日時 2023-08-23 11:51:53
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,316 KB
testcase_01 AC 81 ms
15,084 KB
testcase_02 AC 81 ms
15,072 KB
testcase_03 AC 81 ms
15,016 KB
testcase_04 AC 84 ms
15,088 KB
testcase_05 AC 80 ms
15,248 KB
testcase_06 AC 83 ms
15,248 KB
testcase_07 AC 84 ms
15,136 KB
testcase_08 AC 81 ms
15,124 KB
testcase_09 AC 83 ms
15,144 KB
testcase_10 AC 102 ms
15,808 KB
testcase_11 AC 323 ms
27,936 KB
testcase_12 AC 314 ms
26,684 KB
testcase_13 AC 340 ms
27,936 KB
testcase_14 AC 278 ms
22,032 KB
testcase_15 AC 81 ms
15,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k,x=gets.split.map{|e| e.to_i}
xs=n.times.map{|i| i+1}
(x-1).times{
	a,b=gets.split.map{|e| e.to_i-1}
	xs[a],xs[b]=xs[b],xs[a]
}
gets
arr=[]
(k-x).times{
	a,b=gets.split.map{|e| e.to_i-1}
	arr<<[a,b]
}
arr.reverse!
cs=gets.split.map{|e| e.to_i}
ans=[]
arr.each{|e|
	cs[e[0]],cs[e[1]]=cs[e[1]],cs[e[0]]
}
n.times{|i|
	ans<<(i+1) if cs[i]!=xs[i]	
}
puts ans*" "
0