結果
問題 |
No.1366 交換門松列・梅
|
ユーザー |
![]() |
提出日時 | 2024-08-18 14:50:04 |
言語 | Elixir (1.18.1) |
結果 |
AC
|
実行時間 | 618 ms / 1,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 5,962 ms |
コンパイル使用メモリ | 80,652 KB |
実行使用メモリ | 74,180 KB |
最終ジャッジ日時 | 2025-06-20 11:20:38 |
合計ジャッジ時間 | 16,429 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts(if b, do: "Yes", else: "No") def main do a = li() b = li() for i <- 0..2, j <- 0..2 do [a1, b1, c1] = List.replace_at(a, i, Enum.at(b, j)) [a2, b2, c2] = List.replace_at(b, j, Enum.at(a, i)) is_kadomatu(a1, b1, c1) and is_kadomatu(a2, b2, c2) end |> Enum.any? |> yn end def is_kadomatu(a, b, c) do if a == b or b == c or c == a do false else [_, x, _] = Enum.sort([a, b, c]) b != x end end end