結果
| 問題 |
No.628 Tagの勢い
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-10 08:46:37 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 905 bytes |
| コンパイル時間 | 906 ms |
| コンパイル使用メモリ | 108,288 KB |
| 実行使用メモリ | 20,608 KB |
| 最終ジャッジ日時 | 2024-10-07 22:56:05 |
| 合計ジャッジ時間 | 2,432 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
}
}
}
bluemegane