結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 92 ms
12,416 KB
testcase_03 AC 89 ms
12,288 KB
testcase_04 AC 91 ms
12,288 KB
testcase_05 AC 90 ms
12,416 KB
testcase_06 AC 89 ms
12,416 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 90 ms
12,288 KB
testcase_11 AC 90 ms
12,288 KB
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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, b = aa, bb
    a[i], b[j] = b[j], a[i]
    🎍(*a) && 🎍(*b)
end) ? 'Yes' : 'No'
0