結果

問題 No.602 隠されていたゲーム2
ユーザー chocorusk
提出日時 2019-07-07 18:55:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 860 bytes
コンパイル時間 746 ms
コンパイル使用メモリ 97,228 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-05 05:05:40
合計ジャッジ時間 2,245 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, x, y;
    cin>>n;
    int d[100010];
    for(int i=0; i<n; i++) cin>>d[i];
    cin>>x>>y;
    if(x==0 && y==0){
        cout<<0<<endl;
        return 0;
    }
    for(int i=0; i<n; i++){
        if(abs(x)+abs(y)==d[i]){
            cout<<1<<endl;
            return 0;
        }
    }
    if(abs(x)+abs(y)<=2*(*max_element(d, d+n))) cout<<2<<endl;
    else cout<<-1<<endl;
    return 0;
}
0