結果

問題 No.29 パワーアップ
ユーザー 3qvwn3qvwn
提出日時 2019-07-08 09:29:06
言語 Elixir
(1.7.4)
結果
AC  
実行時間 489 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 599 ms
使用メモリ 49,684 KB
最終ジャッジ日時 2023-01-16 16:43:34
合計ジャッジ時間 12,610 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 469 ms
49,616 KB
testcase_01 AC 482 ms
49,536 KB
testcase_02 AC 467 ms
49,556 KB
testcase_03 AC 475 ms
49,492 KB
testcase_04 AC 466 ms
49,672 KB
testcase_05 AC 473 ms
49,408 KB
testcase_06 AC 465 ms
49,536 KB
testcase_07 AC 474 ms
49,560 KB
testcase_08 AC 452 ms
49,488 KB
testcase_09 AC 473 ms
49,684 KB
testcase_10 AC 464 ms
49,428 KB
testcase_11 AC 473 ms
49,596 KB
testcase_12 AC 460 ms
49,488 KB
testcase_13 AC 471 ms
49,476 KB
testcase_14 AC 481 ms
49,376 KB
testcase_15 AC 481 ms
49,580 KB
testcase_16 AC 478 ms
49,532 KB
testcase_17 AC 474 ms
49,572 KB
testcase_18 AC 470 ms
49,612 KB
testcase_19 AC 469 ms
49,660 KB
testcase_20 AC 466 ms
49,576 KB
testcase_21 AC 489 ms
49,504 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