結果
| 問題 |
No.870 無敵囲い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-19 23:18:44 |
| 言語 | Elixir (1.18.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 754 bytes |
| コンパイル時間 | 831 ms |
| コンパイル使用メモリ | 63,668 KB |
| 実行使用メモリ | 55,328 KB |
| 最終ジャッジ日時 | 2024-06-29 06:40:58 |
| 合計ジャッジ時間 | 13,160 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | TLE * 18 |
ソースコード
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