結果

問題 No.602 隠されていたゲーム2
ユーザー pinpin
提出日時 2017-12-02 02:35:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 81,204 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 19:05:42
合計ジャッジ時間 2,679 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 6 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 32 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 39 ms
4,376 KB
testcase_23 AC 40 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

ll n, x, y,d[100005];
int main(void){
    cin >> n;
    ll Min = 1000000005, Max = -1;
    for (int i = 0; i < n; i++){
        cin >> d[i];
        Min = min(Min, d[i]); Max = max(Max, d[i]);
    }
    cin >> x >> y;
    x = max(x, -x);
    y = max(y, -y);
    
    for (int i = 0; i < n; i++){
        if (x + y == d[i]){
            cout << 1 << endl;
            return 0;
        }
    }

    if (x + y < Min * 2 || x + y > Max * 2) cout << -1 << endl;
    else cout << 2 << endl;

}
0