結果
| 問題 | No.602 隠されていたゲーム2 |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-11-03 15:22:20 |
| 言語 | C# (.NET 10.0.403 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,201 bytes |
| 記録 | |
| コンパイル時間 | 7,628 ms |
| コンパイル使用メモリ | 173,672 KB |
| 実行使用メモリ | 46,080 KB |
| 最終ジャッジ日時 | 2026-11-03 15:22:31 |
| 合計ジャッジ時間 | 9,347 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 4 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (224 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
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);
return;
}
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);
}
}