結果

問題 No.870 無敵囲い
ユーザー gemmarogemmaro
提出日時 2020-04-19 23:18:44
言語 Elixir
(1.16.2)
結果
TLE  
実行時間 -
コード長 754 bytes
コンパイル時間 2,728 ms
コンパイル使用メモリ 53,880 KB
実行使用メモリ 51,488 KB
最終ジャッジ日時 2023-09-11 16:33:11
合計ジャッジ時間 15,743 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    1..(IO.read(:line)
        |> String.trim()
        |> String.to_integer())
    |> Enum.map(fn _ ->
      IO.read(:line)
      |> String.split()
      |> Enum.map(&String.to_integer/1)
    end)
    |> solve
    |> IO.puts()
  end

  def solve(x) do
    solve_rec(x, {2 * 10 + 8, 3 * 10 + 9, 7 * 10 + 9})
  end

  def solve_rec([], {a, b, c}) do
    cond do
      a == 5 * 10 + 8 && b == 4 * 10 + 8 && c == 6 * 10 + 8 -> "YES"
      true -> "NO"
    end
  end

  def solve_rec([[x1, y1, x2, y2] | t], {a, b, c}) do
    solve_rec(
      t,
      case x1 * 10 + y1 do
        ^a -> {x2 * 10 + y2, b, c}
        ^b -> {a, x2 * 10 + y2, c}
        ^c -> {a, b, x2 * 10 + y2}
        _ -> {a, b, c}
      end
    )
  end
end
0