結果

問題 No.602 隠されていたゲーム2
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-11-03 15:15:48
言語 C#
(.NET 10.0.403 + ACL)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
WA  
実行時間 -
コード長 1,179 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,656 ms
コンパイル使用メモリ 173,828 KB
実行使用メモリ 46,156 KB
最終ジャッジ日時 2026-11-03 15:16:07
合計ジャッジ時間 12,176 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (218 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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 d = NList;
        var c = NList;
        var x = (long)Math.Abs(c[0]) + Math.Abs(c[1]);
        var emax = -1;
        var omax = -1;
        if (x == 0)
        {
            WriteLine(0);
        }
        foreach (var di in d)
        {
            if(x == di)
            {
                WriteLine(1);
                return;
            }
            if (di % 2 == 0) emax = Math.Max(emax, di);
            else omax = Math.Max(omax, di);
        }
        var e2max = -1;
        var o2max = -1;
        if (emax > 0) e2max = Math.Max(e2max, emax * 2);
        if (omax > 0) e2max = Math.Max(e2max, omax * 2);
        if (emax > 0 && omax > 0) o2max = emax + omax;
        if (x % 2 == 0) WriteLine(x <= e2max ? 2 : -1);
        else WriteLine(x <= o2max ? 2 : -1);
    }
}
0