結果
問題 | No.602 隠されていたゲーム2 |
ユーザー |
![]() |
提出日時 | 2017-12-02 01:31:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 1,539 ms |
コンパイル使用メモリ | 175,056 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2024-11-28 02:06:13 |
合計ジャッジ時間 | 2,664 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 LOCALstd::ifstream in("in");std::cin.rdbuf(in.rdbuf());#endifint 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 = 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++){int r = upper_bound(d, d + N, D + d[i] + 1) - 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;}