結果

問題 No.1366 交換門松列・梅
ユーザー maimai
提出日時 2019-09-30 04:08:05
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 444 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 7,808 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-14 08:23:47
合計ジャッジ時間 2,121 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:11: warning: assigned but unused variable - aa
Main.rb:12: warning: assigned but unused variable - bb
Syntax OK

ソースコード

diff #

def 🎍(a,b,c)
    a != c && ((a < b && b > c) || (a > b && b < c))
end

line1 = gets.chomp!
line2 = gets.chomp!
abort unless !gets
abort unless line1 =~ /^[1-9] [1-9] [1-9]$/
abort unless line2 =~ /^[1-9] [1-9] [1-9]$/

aa = line1.split.map(&:to_i)
bb = line2.split.map(&:to_i)

puts (3.times.to_a.repeated_permutation(2).find do |i, j|
    # a, b = aa.clone, bb.clone
    a[i], b[j] = b[j], a[i]
    🎍(*a) && 🎍(*b)
end) ? 'Yes' : 'No'
0