結果

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

テストケース

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

ソースコード

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(se.find(x+y)!=se.end()){
        cout<<1<<endl;
        return 0;
    }
    REP(i,n){
        if(se.count(x+y-d[i])||se.count(x+y+d[i])){
            cout<<2<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}
0