結果

問題 No.602 隠されていたゲーム2
ユーザー ei1333333
提出日時 2017-12-02 00:57:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 195,796 KB
最終ジャッジ日時 2025-01-05 04:39:12
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 13 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main()
{
  int N, D[100000], X, Y;

  cin >> N;

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

  cin >> X >> Y;

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

  int F = abs(X) + abs(Y);
  for(int i = 0; i < N; i++) {
    if(F == D[i]) {
      cout << 1 << endl;
      return (0);
    }
  }

  std::random_device rnd;
  std::mt19937 mt(rnd());


  int Z = *max_element(D, D + N);
  if(Z * 2 >= max(abs(X), abs(Y))) {
    if(mt() % 2 == 0) {
      cout << -1 << endl;
      return (0);
    }
    cout << 2 << endl;
    return (0);
  }

  cout << -1 << endl;
}
0