結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-02 05:25:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 846 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 70,232 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-27 22:04:14 |
| 合計ジャッジ時間 | 1,772 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 11 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
int move_mass[n];
for(int i = 0; i < n; i++){
cin >> move_mass[i];
}
int x, y;
cin >> x >> y;
for(int i = 0; i < n; i++){
if(move_mass[i] == abs(x) + abs(y)){
cout << 1 << endl;
return 0;
}
}
for(int i = 0; i < n; i++){
if(upper_bound(move_mass, move_mass + n, abs(x) + abs(y) + move_mass[i]) -
lower_bound(move_mass, move_mass + n, abs(x) + abs(y) + move_mass[i]) ||
upper_bound(move_mass, move_mass + n, abs(x) + abs(y) - move_mass[i]) -
lower_bound(move_mass, move_mass + n, abs(x) + abs(y) - move_mass[i])){
cout << 2 << endl;
return 0;
}
}
cout << -1 << endl;
}