結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー Maeda
提出日時 2025-04-16 17:38:49
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 997 bytes
コンパイル時間 8,554 ms
コンパイル使用メモリ 171,420 KB
実行使用メモリ 224,592 KB
最終ジャッジ日時 2025-04-16 17:39:20
合計ジャッジ時間 21,385 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (118 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        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