結果

問題 No.467 隠されていたゲーム
ユーザー k
提出日時 2021-02-08 21:58:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 1,856 ms
コンパイル使用メモリ 194,188 KB
最終ジャッジ日時 2025-01-18 16:28:33
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;

  vector<int> d(n);
  for (int i = 0; i < n; i++)
    cin >> d[i];
  int x, y;
  cin >> x >> y;

  int l = max(abs(x), abs(y));
  if (l == 0) {
    cout << 0 << endl;
  } else if (find(d.begin(), d.end(), l) != d.end()) {
    cout << 1 << endl;
  } else {
    int dm = *max_element(d.begin(), d.end());
    int ret = max(2, (l + dm - 1) / dm);
    cout << ret << endl;
  }
  
  return 0;
}
0