結果
| 問題 | No.602 隠されていたゲーム2 |
| コンテスト | |
| ユーザー |
creep04
|
| 提出日時 | 2017-12-02 04:05:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 624 bytes |
| 記録 | |
| コンパイル時間 | 2,106 ms |
| コンパイル使用メモリ | 163,036 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 02:37:16 |
| 合計ジャッジ時間 | 2,570 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n, x, y, t;
long long D;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
vector<long long> d(n);
for (int i = 0; i < n; ++i) cin >> d[i];
sort(d.begin(), d.end());
cin >> x >> y;
D = abs(x) + abs(y);
if (D==0) {
cout << 0 << "\n";
return 0;
}
if (binary_search(d.begin(), d.end(), D)) {
cout << 1 << "\n";
return 0;
}
for (int i = 0; i < n-1; ++i) {
if (binary_search(d.begin()+i+1, d.end(), abs(D-d[i]))
|| binary_search(d.begin()+i+1, d.end(), D+d[i])) {
cout << 2 << "\n";
return 0;
}
}
cout << -1 << "\n";
}
creep04