結果
| 問題 | No.628 Tagの勢い |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-21 03:02:15 |
| 言語 | OCaml (5.4.1) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 916 bytes |
| 記録 | |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 22,924 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-25 05:10:56 |
| 合計ジャッジ時間 | 1,371 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
Scanf.scanf "%d" (fun n ->
let module M = Map.Make (struct type t = string let compare = compare end) in
let rec loop i acc =
if i = n then acc else
let acc = Scanf.scanf " %d %d %d" (fun no m s ->
let rec loop_j j acc =
if j = m then acc else
let acc = Scanf.scanf " %s" (fun key ->
M.add key (s + try M.find key acc with _ -> 0) acc)
in
loop_j (j + 1) acc
in
loop_j 0 acc
)
in
loop (i + 1) acc
in
let map = loop 0 M.empty in
let a = Array.of_list @@ M.bindings map in
Array.sort (fun (a1, b1) (a2, b2) -> compare (-b1, a1) (-b2, a2)) a;
for i = 0 to min 9 (Array.length a - 1) do
let (tag, sc) = a.(i) in
Printf.printf "%s %d\n" tag sc
done
)