結果

問題 No.602 隠されていたゲーム2
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-06-07 15:48:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 151,072 KB
実行使用メモリ 5,392 KB
最終ジャッジ日時 2023-08-25 10:56:15
合計ジャッジ時間 4,174 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.06.07 15:48:36
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;cin >> n;
    vector<ll> d;
    for (int i = 0; i < n; i++) {
        ll t;cin >> t;
        d.push_back(t);
        d.push_back(-t);
    }
    sort(d.begin(), d.end());
    ll x,y;cin >> x >> y;
    x = abs(x) + abs(y);
    auto t = lower_bound(d.begin(), d.end(), x);
    if (t != d.end() && x == *t) {
        cout << 1 << endl;
        return 0;
    }
    for (int i = 0; i < d.size(); i++) {
        t = lower_bound(d.begin(), d.end(), x - d[i]);
        if (t != d.end() && x-d[i] == *t) {
            cout << 2 << endl;
            return 0;
        }
    }
    puts("-1");
    return 0;
}
0