結果

問題 No.29 パワーアップ
ユーザー 3qvwn3qvwn
提出日時 2019-07-08 09:29:06
言語 Elixir
(1.16.2)
結果
AC  
実行時間 672 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 56,076 KB
実行使用メモリ 50,488 KB
最終ジャッジ日時 2023-08-29 23:44:24
合計ジャッジ時間 17,376 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 672 ms
49,572 KB
testcase_01 AC 656 ms
50,196 KB
testcase_02 AC 660 ms
49,796 KB
testcase_03 AC 653 ms
49,640 KB
testcase_04 AC 644 ms
50,264 KB
testcase_05 AC 667 ms
49,804 KB
testcase_06 AC 655 ms
49,796 KB
testcase_07 AC 654 ms
49,728 KB
testcase_08 AC 646 ms
49,740 KB
testcase_09 AC 657 ms
49,544 KB
testcase_10 AC 658 ms
49,616 KB
testcase_11 AC 651 ms
50,276 KB
testcase_12 AC 656 ms
50,252 KB
testcase_13 AC 652 ms
49,684 KB
testcase_14 AC 656 ms
50,428 KB
testcase_15 AC 656 ms
50,256 KB
testcase_16 AC 645 ms
50,288 KB
testcase_17 AC 648 ms
50,348 KB
testcase_18 AC 649 ms
49,732 KB
testcase_19 AC 655 ms
50,364 KB
testcase_20 AC 652 ms
50,488 KB
testcase_21 AC 651 ms
49,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do 
  def main do
    n = IO.gets("") |> String.trim |> String.to_integer
    IO.stream(:stdio, :line) |> Enum.take(n) |> Enum.map(&String.trim/1) |> Enum.map(&String.split/1) |> Enum.map(&Enum.map(&1, fn num -> String.to_integer(num) end)) |> Enum.flat_map(fn x -> x end) |> Enum.group_by(fn x -> x end) |> Enum.map(fn  {_, value} -> Enum.count(value) end) |> Enum.map(fn x -> div(x,2) + rem(x,2)/4 end) |> Enum.sum |> trunc |> IO.puts
  end
end
0