Submission #19417262


Source Code Expand

defmodule Main do
  def main() do
    read_single()
    read_nested_list_for(2)
    |> solve()
    |> IO.puts()
  end

  defp solve([a, b]) do
    dot(a, b, 0)
    |> case do
      0 -> "Yes"
      _ -> "No"
    end
  end

  defp dot([], [], acc) do
    acc
  end

  defp dot([h1 | t1], [h2 | t2], acc) do
    dot(t1, t2, acc + h1 * h2)
  end

  defp read_single() do
    IO.read(:line)
    |> String.trim()
    |> String.to_integer()
  end

  defp read_nested_list_for(length) do
    1..length
      |> Enum.reduce([], fn _, acc ->
        list =
          IO.read(:line)
          |> String.trim()
          |> String.split(" ")
          |> Enum.map(&String.to_integer/1)
        [list | acc]
      end)
      |> Enum.reverse()
  end
end

Submission Info

Submission Time
Task B - Orthogonality
User kentarok
Language Elixir (1.10.2)
Score 200
Code Size 782 Byte
Status AC
Exec Time 470 ms
Memory 60336 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All extreme_00.txt, extreme_01.txt, extreme_02.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, handmade_04.txt, handmade_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
extreme_00.txt AC 453 ms 56056 KiB
extreme_01.txt AC 440 ms 56180 KiB
extreme_02.txt AC 399 ms 30532 KiB
handmade_00.txt AC 401 ms 30588 KiB
handmade_01.txt AC 404 ms 30408 KiB
handmade_02.txt AC 420 ms 30584 KiB
handmade_03.txt AC 402 ms 30588 KiB
handmade_04.txt AC 395 ms 30612 KiB
handmade_05.txt AC 422 ms 30452 KiB
random_00.txt AC 470 ms 60284 KiB
random_01.txt AC 443 ms 60336 KiB
random_02.txt AC 399 ms 31868 KiB
random_03.txt AC 428 ms 57200 KiB
random_04.txt AC 401 ms 32476 KiB
random_05.txt AC 420 ms 46972 KiB
sample_01.txt AC 395 ms 30676 KiB
sample_02.txt AC 401 ms 30564 KiB
sample_03.txt AC 392 ms 30744 KiB