結果

問題 No.602 隠されていたゲーム2
ユーザー nebukuro09nebukuro09
提出日時 2017-12-02 00:29:12
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 792 bytes
コンパイル時間 3,474 ms
コンパイル使用メモリ 102,560 KB
実行使用メモリ 37,480 KB
最終ジャッジ日時 2023-08-18 18:33:16
合計ジャッジ時間 5,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
19,532 KB
testcase_01 AC 58 ms
21,608 KB
testcase_02 AC 59 ms
19,468 KB
testcase_03 AC 55 ms
19,452 KB
testcase_04 AC 58 ms
21,704 KB
testcase_05 AC 57 ms
21,628 KB
testcase_06 AC 57 ms
23,636 KB
testcase_07 WA -
testcase_08 AC 58 ms
21,708 KB
testcase_09 WA -
testcase_10 AC 59 ms
23,484 KB
testcase_11 AC 57 ms
23,628 KB
testcase_12 AC 58 ms
21,708 KB
testcase_13 AC 56 ms
19,532 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 84 ms
22,920 KB
testcase_18 AC 118 ms
33,532 KB
testcase_19 AC 133 ms
35,424 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string s = Console.ReadLine();
        int N = int.Parse(s);

        s = Console.ReadLine();
        var t = s.Split(' ');
        var D = new int[N];
        for (int i = 0; i < N; ++i) {
            D[i] = int.Parse(t[i]);
        }
        Array.Sort(D);

        s = Console.ReadLine();
        t = s.Split(' ');

        int x = int.Parse(t[0]);
        int y = int.Parse(t[1]);

        int X = Math.Abs(x + y);
        int Y = Math.Abs(x - y);

        if (D.Contains(Math.Max(X, Y))) {
            Console.WriteLine(1);
        } else if (N >= 2 && D[N-1] + D[N-2] >= Math.Max(X, Y)) {
            Console.WriteLine(2);
        } else {
            Console.WriteLine(-1);
        }
    }
}
0