結果

問題 No.2126 MEX Game
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-18 01:06:19
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 7,225 ms
コンパイル使用メモリ 157,336 KB
実行使用メモリ 177,252 KB
最終ジャッジ日時 2023-10-18 01:06:32
合計ジャッジ時間 12,594 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
32,452 KB
testcase_01 AC 78 ms
32,452 KB
testcase_02 AC 79 ms
32,452 KB
testcase_03 AC 80 ms
32,452 KB
testcase_04 AC 79 ms
32,452 KB
testcase_05 AC 77 ms
32,452 KB
testcase_06 AC 77 ms
32,452 KB
testcase_07 AC 77 ms
32,452 KB
testcase_08 AC 78 ms
32,452 KB
testcase_09 AC 78 ms
32,452 KB
testcase_10 AC 145 ms
41,060 KB
testcase_11 AC 98 ms
41,060 KB
testcase_12 AC 98 ms
41,060 KB
testcase_13 AC 97 ms
41,060 KB
testcase_14 AC 100 ms
41,100 KB
testcase_15 AC 97 ms
41,100 KB
testcase_16 AC 98 ms
40,964 KB
testcase_17 AC 96 ms
39,904 KB
testcase_18 AC 96 ms
40,148 KB
testcase_19 AC 91 ms
38,232 KB
testcase_20 AC 90 ms
38,232 KB
testcase_21 AC 97 ms
41,100 KB
testcase_22 AC 77 ms
32,464 KB
testcase_23 AC 77 ms
32,464 KB
testcase_24 AC 76 ms
32,464 KB
testcase_25 AC 80 ms
32,464 KB
testcase_26 AC 80 ms
32,464 KB
testcase_27 AC 76 ms
32,456 KB
testcase_28 AC 77 ms
32,456 KB
testcase_29 AC 79 ms
177,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (101 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        if (n == 1)
        {
            WriteLine(0);
            return;
        }
        var count = new int[n / 2];
        foreach (var ai in a) if (ai < count.Length) ++count[ai];
        var tmp = 0;
        for (var i = 0; i < count.Length; ++i)
        {
            tmp += Math.Max(0, 2 - count[i]);
            if (tmp >= 2)
            {
                WriteLine(i);
                return;
            }
        }
        WriteLine(count.Length);
    }
}
0