結果

問題 No.429 CupShuffle
ユーザー neko_the_shadowneko_the_shadow
提出日時 2016-10-03 00:31:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 375 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 11,460 KB
実行使用メモリ 31,772 KB
最終ジャッジ日時 2023-08-27 02:08:13
合計ジャッジ時間 4,714 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,036 KB
testcase_01 AC 83 ms
15,248 KB
testcase_02 AC 82 ms
15,040 KB
testcase_03 AC 88 ms
15,156 KB
testcase_04 AC 88 ms
15,256 KB
testcase_05 AC 84 ms
15,264 KB
testcase_06 AC 87 ms
15,028 KB
testcase_07 AC 87 ms
15,252 KB
testcase_08 AC 86 ms
15,096 KB
testcase_09 AC 88 ms
15,240 KB
testcase_10 AC 112 ms
16,196 KB
testcase_11 AC 375 ms
30,056 KB
testcase_12 AC 350 ms
29,532 KB
testcase_13 AC 357 ms
31,772 KB
testcase_14 AC 353 ms
27,768 KB
testcase_15 AC 84 ms
15,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(cups, logs)
  logs.each{|x, y| cups[x - 1], cups[y - 1] = cups[y - 1], cups[x - 1]}
end

n, k, x = gets.split.map(&:to_i)
ls = (1..k).each_with_object([]){|_, arr| arr << gets.split.map(&:to_i)}
before = ls[0, x - 1]
after = ls[x..-1].reverse

start = (1..n).to_a; f(start, before)
answer = gets.split.map(&:to_i); f(answer, after)

puts (0...n).each_with_object([]){|i, arr| arr << i + 1 if start[i] != answer[i]}.join("\s")
0