結果
問題 | No.628 Tagの勢い |
ユーザー | No |
提出日時 | 2018-01-05 23:08:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 121 ms / 2,000 ms |
コード長 | 1,193 bytes |
コンパイル時間 | 934 ms |
コンパイル使用メモリ | 107,264 KB |
実行使用メモリ | 22,016 KB |
最終ジャッジ日時 | 2024-04-16 20:01:35 |
合計ジャッジ時間 | 2,729 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
21,248 KB |
testcase_01 | AC | 43 ms
21,376 KB |
testcase_02 | AC | 43 ms
20,992 KB |
testcase_03 | AC | 43 ms
21,120 KB |
testcase_04 | AC | 35 ms
20,352 KB |
testcase_05 | AC | 41 ms
21,248 KB |
testcase_06 | AC | 42 ms
21,248 KB |
testcase_07 | AC | 42 ms
21,120 KB |
testcase_08 | AC | 44 ms
21,376 KB |
testcase_09 | AC | 44 ms
21,248 KB |
testcase_10 | AC | 46 ms
21,248 KB |
testcase_11 | AC | 44 ms
21,120 KB |
testcase_12 | AC | 119 ms
22,016 KB |
testcase_13 | AC | 121 ms
21,632 KB |
testcase_14 | AC | 121 ms
21,888 KB |
testcase_15 | AC | 121 ms
21,888 KB |
testcase_16 | AC | 64 ms
21,632 KB |
testcase_17 | AC | 42 ms
20,992 KB |
testcase_18 | AC | 42 ms
21,248 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace y { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var d = new SortedDictionary<string, int>(); for (int i = 0; i < n; i++) { Console.ReadLine(); //No string[] ss = Console.ReadLine().Split(); int m = int.Parse(ss[0]); int s = int.Parse(ss[1]); string[] tags = Console.ReadLine().Split(); foreach (var tag in tags) { if (d.ContainsKey(tag)) { d[tag] += s; } else { d.Add(tag, s); } } } int cnt = 0; var ans = d.OrderByDescending((x) => x.Value); foreach (var item in ans) { Console.WriteLine(item.Key + " " + item.Value.ToString()); cnt++; if (cnt == 10) break; } } } }