結果

問題 No.628 Tagの勢い
ユーザー taktak
提出日時 2018-03-20 00:27:29
言語 F#
(F# 4.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 8,048 ms
コンパイル使用メモリ 185,420 KB
実行使用メモリ 36,016 KB
最終ジャッジ日時 2024-04-16 20:10:36
合計ジャッジ時間 15,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 351 ms
35,304 KB
testcase_01 AC 350 ms
35,564 KB
testcase_02 AC 348 ms
35,184 KB
testcase_03 AC 348 ms
35,560 KB
testcase_04 AC 349 ms
36,000 KB
testcase_05 AC 354 ms
35,304 KB
testcase_06 AC 348 ms
35,448 KB
testcase_07 AC 344 ms
35,316 KB
testcase_08 AC 346 ms
35,436 KB
testcase_09 AC 351 ms
35,320 KB
testcase_10 AC 348 ms
35,356 KB
testcase_11 AC 349 ms
35,336 KB
testcase_12 AC 351 ms
35,900 KB
testcase_13 AC 352 ms
35,640 KB
testcase_14 AC 352 ms
35,768 KB
testcase_15 AC 350 ms
36,016 KB
testcase_16 AC 347 ms
35,784 KB
testcase_17 AC 348 ms
35,316 KB
testcase_18 AC 347 ms
35,308 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (239 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