結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
20,096 KB
testcase_01 AC 38 ms
20,096 KB
testcase_02 AC 38 ms
19,840 KB
testcase_03 AC 38 ms
19,968 KB
testcase_04 AC 33 ms
19,200 KB
testcase_05 AC 37 ms
20,096 KB
testcase_06 AC 37 ms
19,968 KB
testcase_07 AC 37 ms
19,968 KB
testcase_08 AC 41 ms
20,096 KB
testcase_09 AC 40 ms
20,224 KB
testcase_10 AC 38 ms
19,968 KB
testcase_11 AC 40 ms
19,968 KB
testcase_12 AC 41 ms
20,736 KB
testcase_13 AC 41 ms
20,480 KB
testcase_14 AC 41 ms
20,608 KB
testcase_15 AC 42 ms
20,736 KB
testcase_16 AC 40 ms
20,352 KB
testcase_17 AC 38 ms
19,968 KB
testcase_18 AC 39 ms
19,968 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);
        if (d.Count() >= 10)
            foreach (var x in d.OrderByDescending(x => x.Value).ThenBy(x => x.Key).Take(10))
                Console.WriteLine("{0} {1}", x.Key, x.Value);
        else
            foreach (var x in d.OrderByDescending(x => x.Value).ThenBy(x => x.Key))
                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