結果

問題 No.628 Tagの勢い
ユーザー mbanmban
提出日時 2018-01-09 18:59:08
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,325 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 109,312 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-04-16 20:03:44
合計ジャッジ時間 2,421 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            //Console.WriteLine(Next());
            return int.Parse(Next());
            //return 1;
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }

    class HashMap<K, V> : Dictionary<K, V>
    {
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }

    class Program
    {
        HashMap<string, int> Hs = new HashMap<string, int>();

        public void Solve()
        {
            var sc = new Scanner();
            var n = sc.NextInt();
            for (int i = 0; i < n; i++)
            {
                sc.Next();
                sc.Next();
                var s = sc.NextInt();
                var tag = sc.Array();
                foreach (var ss in tag)
                {
                    Hs[ss] += s;
                }
            }
            var ans = Hs.ToArray();
            Array.Sort(ans, (a, b) => -a.Value.CompareTo(b.Value));
            for (int i = 0; i < Math.Min(10, ans.Length); i++)
            {
                var p = ans[i];
                Console.WriteLine($"{p.Key} {p.Value}");
            }
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}
0