結果

問題 No.602 隠されていたゲーム2
ユーザー Lepton_sLepton_s
提出日時 2017-12-02 00:11:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,572 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 97,880 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 21:37:39
合計ジャッジ時間 2,114 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 14 ms
5,376 KB
testcase_18 AC 33 ms
5,376 KB
testcase_19 AC 43 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 43 ms
5,376 KB
testcase_23 AC 38 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	cin>>n;
	vector<ll> x(n);
	rep(i, n) cin>>x[i];
	sort(all(x));
	ll a, b;
	cin>>a>>b;
	ll c = abs(a)+abs(b);
	if(c==0){
		cout<<0<<endl;
		return 0;
	}
	rep(i, n){
		if(c==x[i]){
			cout<<1<<endl;
			return 0;
		}
	}
	ll d1 = -1e10, d2 = -1e10;
	rep(i, n){
		if(x[i]%2==0) d2 = max(d2, x[i]);
		else d1 = max(d1, x[i]);
	}
	ll dd = max(d1, d2)*2;
	if((c%2==0 && c<=dd) || c<=d1+d2) cout<<2<<endl;
	else cout<<-1<<endl;
	return 0;
}
0