結果

問題 No.602 隠されていたゲーム2
ユーザー femto
提出日時 2017-12-02 00:47:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 1,589 ms
コンパイル使用メモリ 171,412 KB
実行使用メモリ 8,960 KB
最終ジャッジ日時 2024-11-28 01:56:58
合計ジャッジ時間 2,779 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll d[100000];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	cin >> N;
	set<ll> s;
	for(int i = 0; i < N; i++){
		cin >> d[i];
		s.insert(d[i]);
	}

	ll x, y;
	cin >> x >> y;
	ll D = abs(x) + abs(y);
	if(D == 0){
		cout << 0 << endl;
		return 0;
	}
	if(s.count(D)){
		cout << 1 << endl;
		return 0;
	}
	for(int i = 0; i < N; i++){
		ll nd = abs(D - d[i]);
		if(s.count(nd)){
			cout << 2 << endl;
			return 0;
		}
	}
	cout << -1 << endl;

}
0