結果

問題 No.602 隠されていたゲーム2
ユーザー たこしたこし
提出日時 2017-12-02 09:00:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 149,500 KB
実行使用メモリ 9,020 KB
最終ジャッジ日時 2023-08-18 19:54:50
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 9 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 58 ms
7,756 KB
testcase_19 WA -
testcase_20 AC 52 ms
8,760 KB
testcase_21 AC 61 ms
8,788 KB
testcase_22 WA -
testcase_23 AC 71 ms
8,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using LL = long long int;
using II = pair<int, int>;

const int MAX_N = 100005;

#define int long long

int N;
int D[MAX_N];
int X, Y;

signed main()
{
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> D[i];
  }
  cin >> X >> Y;

  int XYD = abs(X) + abs(Y);

  if(X == 0 && Y == 0) {
    cout << 0 << endl;
    return 0;
  }

  set<int> S;
  for(int i = 0; i < N; i++) {
    if(XYD == D[i]) {
      cout << 1 << endl;
      return 0;
    }
    S.insert(D[i]);
  }

  for(int i = 0; i < N; i++) {
    if(S.find(XYD - D[i]) != S.end()) {
      cout << 2 << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}
0