結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2020-06-07 15:48:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 776 bytes |
| コンパイル時間 | 1,558 ms |
| コンパイル使用メモリ | 164,112 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-23 17:31:11 |
| 合計ジャッジ時間 | 3,327 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 8 |
ソースコード
/**
* @FileName a.cpp
* @Author kanpurin
* @Created 2020.06.07 15:48:36
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int n;cin >> n;
vector<ll> d;
for (int i = 0; i < n; i++) {
ll t;cin >> t;
d.push_back(t);
d.push_back(-t);
}
sort(d.begin(), d.end());
ll x,y;cin >> x >> y;
x = abs(x) + abs(y);
auto t = lower_bound(d.begin(), d.end(), x);
if (t != d.end() && x == *t) {
cout << 1 << endl;
return 0;
}
for (int i = 0; i < d.size(); i++) {
t = lower_bound(d.begin(), d.end(), x - d[i]);
if (t != d.end() && x-d[i] == *t) {
cout << 2 << endl;
return 0;
}
}
puts("-1");
return 0;
}
🍮かんプリン