結果

問題 No.1468 Colourful Pastel
ユーザー bluemegane
提出日時 2021-04-09 22:52:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 110 ms / 1,000 ms
コード長 906 bytes
コンパイル時間 1,058 ms
コンパイル使用メモリ 104,320 KB
実行使用メモリ 34,432 KB
最終ジャッジ日時 2024-06-25 06:35:00
合計ジャッジ時間 3,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var d1 = getD(line);
        line = Console.ReadLine().Trim().Split(' ');
        var d2 = getD(line);
        getAns(d1, d2);
    }
    static void getAns(Dictionary<string, int> d1, Dictionary<string, int> d2)
    {
        foreach (var x in d1)
        {
            if (!d2.ContainsKey(x.Key)) { Console.WriteLine(x.Key); return; }
            else if (x.Value != d2[x.Key]) { Console.WriteLine(x.Key); return; }
        }
    }
    static Dictionary<string, int> getD(string[] s)
    {
        var d = new Dictionary<string, int>();
        foreach (var x in s)
        {
            if (d.ContainsKey(x)) d[x]++;
            else d[x] = 1;
        }
        return d;
    }
}
0