結果

問題 No.1366 交換門松列・梅
ユーザー universatouniversato
提出日時 2021-01-29 21:44:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 11,492 KB
実行使用メモリ 15,356 KB
最終ジャッジ日時 2023-09-09 15:06:28
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,132 KB
testcase_01 AC 79 ms
15,132 KB
testcase_02 AC 77 ms
15,068 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 78 ms
15,316 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 79 ms
15,244 KB
testcase_11 AC 75 ms
15,248 KB
testcase_12 AC 80 ms
15,012 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Array
  def kadomatsu?
    return nil unless size == 3
    return false unless uniq.size == 3
    
    self[2] == min || self[2] == max
  end
end

a = gets.to_s.split.map{ |e| e.to_i }
b = gets.to_s.split.map{ |e| e.to_i }

[0, 1, 2].zip([0, 1, 2]) do |i, j|
  c = a.dup
  d = b.dup
  c[i], d[j] = d[j], c[i]
  if c.kadomatsu? && d.kadomatsu?
    puts "Yes"
    exit
  end
end

puts "No"
0