結果

問題 No.2590 100000 Days of Christmas
ユーザー bluemeganebluemegane
提出日時 2024-04-11 15:16:04
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 8,001 ms
コンパイル使用メモリ 167,900 KB
実行使用メモリ 215,988 KB
最終ジャッジ日時 2024-04-11 15:16:16
合計ジャッジ時間 12,027 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
29,800 KB
testcase_01 AC 55 ms
30,336 KB
testcase_02 AC 53 ms
29,948 KB
testcase_03 AC 52 ms
29,800 KB
testcase_04 AC 52 ms
29,808 KB
testcase_05 AC 54 ms
30,072 KB
testcase_06 AC 149 ms
56,384 KB
testcase_07 AC 78 ms
36,092 KB
testcase_08 WA -
testcase_09 AC 77 ms
35,568 KB
testcase_10 AC 54 ms
30,208 KB
testcase_11 AC 53 ms
30,208 KB
testcase_12 AC 54 ms
30,208 KB
testcase_13 WA -
testcase_14 AC 55 ms
29,808 KB
testcase_15 AC 53 ms
30,208 KB
testcase_16 AC 54 ms
29,944 KB
testcase_17 AC 53 ms
29,952 KB
testcase_18 AC 53 ms
30,208 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (92 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        var d = new Dictionary<string, long>();
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            if (d.ContainsKey(s)) d[s] += (long)(i + 1) * (n - i);
            else d[s] = (long)(i + 1) * (n - i);
        }
        var Lex = d.Keys.ToList();
        Lex.Sort(StringComparer.Ordinal);
        var sb = new StringBuilder();
        foreach (var x in Lex) sb.Append(string.Format("{0} {1}\n", d[x], x));
        Console.Write(sb);
    }
}
0