結果
問題 | No.2153 何コーダーが何人? |
ユーザー |
![]() |
提出日時 | 2024-09-02 01:28:22 |
言語 | Elixir (1.18.1) |
結果 |
AC
|
実行時間 | 743 ms / 2,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 2,315 ms |
コンパイル使用メモリ | 62,068 KB |
実行使用メモリ | 56,200 KB |
最終ジャッジ日時 | 2024-09-02 01:28:41 |
合計ジャッジ時間 | 18,349 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts(if b, do: "Yes", else: "No") def main do n = ii() for _ <- 1..n, reduce: %{} do acc -> [s, c] = input() |> String.split color = String.to_integer(c) if Map.has_key?(acc, s) do %{acc | s => color} else Map.put(acc, s, color) end end |> Enum.frequencies_by(fn {_, v} -> v end) |> then(fn freq -> for i <- 0..7 do IO.puts Map.get(freq, i, 0) end end) end end