結果

問題 No.602 隠されていたゲーム2
ユーザー SugarDragon5SugarDragon5
提出日時 2017-12-02 10:11:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 951 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 172,940 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-05-06 01:39:55
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    vi d(n);
    set<int> se;
    REP(i,n){
        cin>>d[i];
        se.insert(d[i]);
    }
    int x,y;
    cin>>x>>y;
    x=abs(x);
    y=abs(y);
    if(!(x+y)){
        cout<<0<<endl;
        return 0;
    }
    if(se.find(x+y)!=se.end()){
        cout<<1<<endl;
        return 0;
    }
    REP(i,n){
        if(se.lower_bound(x+y-d[i])!=se.end()){
            cout<<2<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}
0