結果
| 問題 |
No.628 Tagの勢い
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2018-01-05 23:08:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 118 ms / 2,000 ms |
| コード長 | 1,193 bytes |
| コンパイル時間 | 914 ms |
| コンパイル使用メモリ | 113,296 KB |
| 実行使用メモリ | 22,144 KB |
| 最終ジャッジ日時 | 2024-10-07 22:16:18 |
| 合計ジャッジ時間 | 2,914 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
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;
}
}
}
}
No