結果

問題 No.1250 汝は倍数なりや?
ユーザー a01sa01toa01sa01to
提出日時 2024-01-24 00:29:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 210,736 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-01-24 00:29:31
合計ジャッジ時間 17,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 WA -
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 WA -
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 3 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 WA -
testcase_29 AC 2 ms
6,676 KB
testcase_30 AC 2 ms
6,676 KB
testcase_31 AC 2 ms
6,676 KB
testcase_32 AC 3 ms
6,676 KB
testcase_33 TLE -
testcase_34 AC 613 ms
7,424 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 663 ms
7,680 KB
testcase_38 AC 715 ms
8,064 KB
testcase_39 AC 616 ms
7,424 KB
testcase_40 AC 638 ms
7,552 KB
testcase_41 AC 826 ms
8,704 KB
testcase_42 AC 440 ms
6,676 KB
testcase_43 TLE -
testcase_44 AC 478 ms
6,676 KB
testcase_45 TLE -
testcase_46 AC 319 ms
6,676 KB
testcase_47 AC 717 ms
7,936 KB
testcase_48 AC 2 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 2 ms
6,676 KB
testcase_51 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int n, h;
  cin >> n >> h;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;
  for (int x : a) {
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        mp[i]++;
        while (x % i == 0) x /= i, mp[i]++;
      }
    }
    if (x != 1) mp[x]++;
  }
  for (int i = 2; i * i <= h; i++) {
    if (h % i == 0) {
      if (mp[i] == 0) {
        cout << "NO" << endl;
        return 0;
      }
      while (h % i == 0) h /= i, mp[i]--;
    }
  }
  if (h != 1 && mp[h] == 0) {
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }
  return 0;
}
0