結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2017-12-02 01:39:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 712 bytes |
| コンパイル時間 | 1,467 ms |
| コンパイル使用メモリ | 175,172 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2024-11-28 02:07:28 |
| 合計ジャッジ時間 | 2,633 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 6 |
ソースコード
#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]);
}
sort(d, d + N);
ll x, y;
cin >> x >> y;
ll D = max(abs(x), abs(y));
if(D == 0){
cout << 0 << endl;
return 0;
}
if(s.count(abs(x) + abs(y))){
cout << 1 << endl;
return 0;
}
for(int i = 0; i < N; i++){
int r = upper_bound(d, d + N, D + d[i]) - d;
int l = lower_bound(d, d + N, abs(D - d[i])) - d;
if(r - l >= 1){
cout << 2 << endl;
return 0;
}
}
cout << -1 << endl;
}
femto