結果

問題 No.24 数当てゲーム
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-04 13:32:31
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 1,844 bytes
コンパイル時間 8,425 ms
コンパイル使用メモリ 170,996 KB
実行使用メモリ 189,940 KB
最終ジャッジ日時 2025-11-04 13:32:42
合計ジャッジ時間 10,335 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (117 ミリ秒)。
  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(string[] args)
    {
        string inputTurn = Console.ReadLine()!;
        int turn = int.Parse(inputTurn);
        List<string> yesList = new List<string>();
        List<string> noList = new List<string>();

        for (int i = 0; i < turn; i++)
        {
            string[] inputNum = Console.ReadLine()!.Split(' ');

            if (inputNum[4] == "YES")
            {
                for (int j = 0; j < 4; j++)
                {
                    yesList.Add(inputNum[j]);
                }
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    noList.Add(inputNum[j]);
                }
            }
        }

        yesList.Sort();
        List<string> duplicateList = new List<string>();
        for (int i = 1; i < yesList.Count; i++)
        {
            if (yesList[i - 1] == yesList[i])
            {
                duplicateList.Add(yesList[i]);
            }
        }

        List<string> notIncluded = new List<string>();
        HashSet<string> listSet = new HashSet<string>(noList);

        for (int i = 0; i <= 9; i++)
        {
            if (!listSet.Contains(i.ToString()))
            {
                notIncluded.Add(i.ToString());
            }
        }

        if (noList.Count == 0)
        {
            Console.WriteLine(duplicateList[0]);
        }
        else if (yesList.Count == 0)
        {
            Console.WriteLine(notIncluded[0]);
        }
        else
        {
            listSet = new HashSet<string>(notIncluded);
            for (int i = 0; i < duplicateList.Count; i++)
            {
                if (listSet.Contains(duplicateList[i]))
                {
                    Console.WriteLine(duplicateList[i]);
                }
            }
        }

    }
}
0