結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー Maeda
提出日時 2025-04-16 17:38:10
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 427 ms / 2,000 ms
コード長 1,120 bytes
コンパイル時間 7,185 ms
コンパイル使用メモリ 172,304 KB
実行使用メモリ 225,444 KB
最終ジャッジ日時 2025-04-16 17:38:33
合計ジャッジ時間 19,594 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (106 ミリ秒)。
/home/judge/data/code/Main.cs(6,24): warning CS0649: フィールド 'Program.ScoreList.userPoint' は割り当てられません。常に既定値 0 を使用します [/home/judge/data/code/main.csproj]
/home/judge/data/code/Main.cs(5,27): warning CS0649: フィールド 'Program.ScoreList.userName' は割り当てられません。常に既定値 null を使用します [/home/judge/data/code/main.csproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        public struct ScoreList
        {
            public string userName ;
            public int userPoint;
        }
        static void Main()
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(' '), num => int.Parse(num.ToString()));
            var result = new Dictionary<string, int>();
            for (int i = 0; i < nm[0]; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                result.Add(str[0], int.Parse(str[1]));
            }
            for (int i = 0; i < nm[1]; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                if (result.ContainsKey(str[0]))
                {
                    result[str[0]] = int.Parse(str[1]);
                }
                else
                {
                    result.Add(str[0], int.Parse(str[1]));
                }
            }
            
            foreach (var i in result.Keys.OrderBy(x => x, StringComparer.Ordinal))
            {
                Console.WriteLine(i + " " + result[i]);
            }
        }
    }
0