Submission #19864680


Source Code Expand

Copy
defmodule Main do
def main() do
[_n, m] =
IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)
ab_of_lists =
1..m
|> Enum.reduce([], fn _, acc ->
list =
IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)
[list | acc]
end)
k = IO.read(:line) |> String.trim() |> String.to_integer()
cd_of_lists =
1..k
|> Enum.reduce([], fn _, acc ->
list =
IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
defmodule Main do
  def main() do
    [_n, m] =
      IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)

    ab_of_lists =
      1..m
      |> Enum.reduce([], fn _, acc ->
        list =
          IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)

        [list | acc]
      end)

    k = IO.read(:line) |> String.trim() |> String.to_integer()

    cd_of_lists =
      1..k
      |> Enum.reduce([], fn _, acc ->
        list =
          IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)

        [list | acc]
      end)

    product(cd_of_lists)
    |> Enum.map(fn list ->
      Enum.count(ab_of_lists, fn [a, b] ->
        a in list && b in list
      end)
    end)
    |> Enum.max()
    |> IO.puts()
  end

  def product(list_of_lists) do
    Enum.reduce(list_of_lists, [[]], fn [x, y], acc1 ->
      Enum.reduce(acc1, [], fn list, acc2 ->
        [[x | list], [y | list] | acc2]
      end)
    end)
  end
end

Submission Info

Submission Time
Task C - Bowls and Dishes
User awesomey
Language Elixir (1.10.2)
Score 300
Code Size 1066 Byte
Status AC
Exec Time 893 ms
Memory 48456 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 38
Set Name Test Cases
Sample 01_sample.txt, 02_sample.txt, 03_sample.txt
All 01_sample.txt, 02_sample.txt, 03_sample.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_small.txt, 10_small.txt, 11_small.txt, 12_small.txt, 13_large.txt, 14_large.txt, 15_large.txt, 16_large.txt, 17_large.txt, 18_large.txt, 19_large.txt, 20_large.txt, 21_large.txt, 22_max.txt, 23_max.txt, 24_max.txt, 25_max.txt, 26_max.txt, 27_max.txt, 28_max.txt, 29_max.txt, 30_max.txt, 31_max.txt, 32_max.txt, 33_max.txt, 34_max.txt, 35_star.txt, 36_star.txt, 37_star.txt, 38_star.txt
Case Name Status Exec Time Memory
01_sample.txt AC 343 ms 30364 KB
02_sample.txt AC 325 ms 30584 KB
03_sample.txt AC 335 ms 30380 KB
04_small.txt AC 320 ms 30676 KB
05_small.txt AC 336 ms 30444 KB
06_small.txt AC 328 ms 30692 KB
07_small.txt AC 327 ms 30572 KB
08_small.txt AC 334 ms 30616 KB
09_small.txt AC 319 ms 30452 KB
10_small.txt AC 319 ms 30848 KB
11_small.txt AC 327 ms 30848 KB
12_small.txt AC 320 ms 30548 KB
13_large.txt AC 438 ms 48376 KB
14_large.txt AC 646 ms 44748 KB
15_large.txt AC 347 ms 30800 KB
16_large.txt AC 364 ms 31744 KB
17_large.txt AC 405 ms 32860 KB
18_large.txt AC 525 ms 48268 KB
19_large.txt AC 351 ms 32612 KB
20_large.txt AC 325 ms 32248 KB
21_large.txt AC 322 ms 30524 KB
22_max.txt AC 755 ms 47848 KB
23_max.txt AC 753 ms 48336 KB
24_max.txt AC 869 ms 47848 KB
25_max.txt AC 824 ms 48236 KB
26_max.txt AC 827 ms 48288 KB
27_max.txt AC 893 ms 48284 KB
28_max.txt AC 786 ms 48060 KB
29_max.txt AC 837 ms 48032 KB
30_max.txt AC 825 ms 47948 KB
31_max.txt AC 888 ms 48456 KB
32_max.txt AC 863 ms 47972 KB
33_max.txt AC 759 ms 48092 KB
34_max.txt AC 823 ms 48276 KB
35_star.txt AC 818 ms 48156 KB
36_star.txt AC 804 ms 47996 KB
37_star.txt AC 796 ms 48064 KB
38_star.txt AC 782 ms 48128 KB


2025-04-03 (Thu)
17:00:26 +00:00