結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2017-12-02 00:49:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 678 bytes |
| コンパイル時間 | 1,566 ms |
| コンパイル使用メモリ | 171,796 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2024-11-28 01:57:42 |
| 合計ジャッジ時間 | 2,764 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
#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;
}
nd = D + d[i];
if(s.count(nd)){
cout << 2 << endl;
return 0;
}
}
cout << -1 << endl;
}
femto