結果

問題 No.1692 Expectations
ユーザー Maeda
提出日時 2025-04-16 14:17:00
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 920 bytes
コンパイル時間 7,288 ms
コンパイル使用メモリ 170,820 KB
実行使用メモリ 210,488 KB
最終ジャッジ日時 2025-04-16 14:17:12
合計ジャッジ時間 10,019 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (104 ミリ秒)。
  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()));
            int[] list = Array.ConvertAll(Console.ReadLine().Split(' '), num => int.Parse(num.ToString()));
            Array.Sort(list);
            int max = MaxNumberCount(list);
            int min = 0;
            if(max == 1 && nm[0] == nm[1])
            {
                min = 1;
            }
            else
            {
                min = 0;
            }
            Console.WriteLine(max + " " + min);
        }

        private static int MaxNumberCount(int[] list)
        {
            int max = list.Length;
            for(int i = 1; i < list.Length; i++)
            {
                if (list[i-1] == list[i])
                {
                    max--;
                }
            }
            return max;
        }
    }
0