結果

問題 No.2590 100000 Days of Christmas
ユーザー bluemeganebluemegane
提出日時 2024-04-11 15:19:47
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 19,366 ms
コンパイル使用メモリ 168,936 KB
実行使用メモリ 215,820 KB
最終ジャッジ日時 2024-04-11 15:20:12
合計ジャッジ時間 15,012 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
29,824 KB
testcase_01 AC 62 ms
29,824 KB
testcase_02 AC 75 ms
29,824 KB
testcase_03 AC 70 ms
30,208 KB
testcase_04 AC 64 ms
29,800 KB
testcase_05 AC 64 ms
29,952 KB
testcase_06 AC 158 ms
56,008 KB
testcase_07 AC 82 ms
35,452 KB
testcase_08 AC 235 ms
59,704 KB
testcase_09 AC 90 ms
35,328 KB
testcase_10 AC 58 ms
30,208 KB
testcase_11 AC 55 ms
30,208 KB
testcase_12 AC 60 ms
29,948 KB
testcase_13 AC 71 ms
30,208 KB
testcase_14 AC 59 ms
30,208 KB
testcase_15 AC 59 ms
30,208 KB
testcase_16 AC 67 ms
29,804 KB
testcase_17 AC 62 ms
29,948 KB
testcase_18 AC 58 ms
29,824 KB
testcase_19 AC 62 ms
30,336 KB
testcase_20 AC 219 ms
59,376 KB
testcase_21 AC 241 ms
59,416 KB
testcase_22 AC 212 ms
58,408 KB
testcase_23 AC 248 ms
215,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (117 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();
            if (d.ContainsKey(s)) d[s] += (long)(i + 1) * (n - i);
            else d[s] = (long)(i + 1) * (n - i);
        }
        var Lex = d.Keys.ToArray();
        Array.Sort(Lex, 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