結果

問題 No.628 Tagの勢い
ユーザー tak
提出日時 2018-03-20 00:27:29
言語 F#
(F# 4.0)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 6,621 ms
コンパイル使用メモリ 184,944 KB
実行使用メモリ 36,196 KB
最終ジャッジ日時 2024-10-07 22:38:46
合計ジャッジ時間 14,337 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (233 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System
open System.Collections.Generic
open System.Linq

let read() = Console.ReadLine()
let Int () = read() |> int    
let Ints() = read().Split()
             |> Array.map(int)
let Int2() = 
    let t = Ints()
    t.[0],t.[1]

let dict = Dictionary<string,int>()             
let N    = Int()
for i in 1..N do 
    let No   = Int()
    let M,S  = Int2()
    let tags = read().Split()
    for t in tags do 
        if not <| dict.ContainsKey t then 
            dict.[t] <- S
        else
            dict.[t] <- dict.[t] + S

dict.OrderByDescending(fun kp -> kp.Value).ThenBy(fun kp -> kp.Key).Take(10)
|> Seq.iter (fun kp -> printfn "%s %i" kp.Key kp.Value)

  
             
                                                  
0