結果

問題 No.628 Tagの勢い
ユーザー bluemeganebluemegane
提出日時 2018-09-10 08:46:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 905 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 106,624 KB
実行使用メモリ 20,480 KB
最終ジャッジ日時 2024-04-16 20:17:23
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
19,968 KB
testcase_01 AC 39 ms
19,840 KB
testcase_02 AC 38 ms
19,712 KB
testcase_03 AC 39 ms
19,840 KB
testcase_04 AC 34 ms
19,072 KB
testcase_05 AC 38 ms
19,712 KB
testcase_06 AC 38 ms
19,968 KB
testcase_07 AC 39 ms
19,712 KB
testcase_08 AC 38 ms
19,840 KB
testcase_09 AC 38 ms
19,840 KB
testcase_10 AC 39 ms
19,840 KB
testcase_11 AC 39 ms
19,968 KB
testcase_12 AC 44 ms
20,096 KB
testcase_13 AC 44 ms
20,480 KB
testcase_14 AC 43 ms
20,352 KB
testcase_15 AC 43 ms
20,352 KB
testcase_16 AC 41 ms
20,224 KB
testcase_17 AC 39 ms
19,840 KB
testcase_18 AC 39 ms
19,840 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<string, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++) getDic(d);
            foreach (var x in d.OrderByDescending(x => x.Value).ThenBy(x => x.Key).Take(Math.Min(10,d.Count())))
                Console.WriteLine("{0} {1}", x.Key, x.Value);

    }
    public static void getDic(Dictionary<string, int> d)
    {
        Console.ReadLine().Trim();
        string[] line = Console.ReadLine().Trim().Split(' ');
        var m = int.Parse(line[0]);
        var s = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < m; i++)
        {
            var t = line[i];
            if (d.ContainsKey(t)) d[t] += s;
            else d[t] = s;
        }
    }
}
0