結果

問題 No.1250 汝は倍数なりや?
ユーザー cumincumin
提出日時 2021-02-05 15:28:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,239 bytes
コンパイル時間 8,356 ms
コンパイル使用メモリ 300,552 KB
実行使用メモリ 4,572 KB
最終ジャッジ日時 2023-09-14 23:51:33
合計ジャッジ時間 10,419 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 2 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 34 ms
4,376 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 19 ms
4,376 KB
testcase_38 AC 20 ms
4,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 24 ms
4,380 KB
testcase_42 AC 13 ms
4,376 KB
testcase_43 AC 30 ms
4,376 KB
testcase_44 AC 13 ms
4,376 KB
testcase_45 WA -
testcase_46 AC 10 ms
4,376 KB
testcase_47 WA -
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 2 ms
4,384 KB
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>

#define ll long long
#define ld long double

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define rrep(i, a, b) for(int i = a; i >= b; --i)

#define pii pair<int, int>
#define pdd pair<double, double>
#define pll pair<ll, ll>
#define pld pair<ld,ld>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vd vector<double>
#define vll vector<ll>
#define vld vector<ld>
#define vpii vector<pii>
#define vpdd vector<pdd>
#define vpll vector<pll>
#define vpld vector<pld>
#define vvi(a,b,c,d) vector<vector<int>> a(b,vector<int>(c,d));
#define vvll(a,b,c,d) vector<vector<ll>> a(b,vector<ll>(c,d));

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define MAX(x) *max_element(all(x)) 
#define MIN(x) *min_element(all(x)) 
#define sz(a) ((ll)(a).size())

#define endl '\n'
using namespace std;
using namespace atcoder;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll INF=1e18+1;
const int inf=1e9+1;
const double PI=acos(-1);
int dy[8] = {0,1,0,-1,-1,1,1,-1};
int dx[8] = {1,0,-1,0,1,1,-1,-1};

bool range(int y, int x, int h, int w){
  if(y < 0 || x < 0 || y >= h || x >= w) return false;
  else return true;
}

//const int MOD=1000000007;
//using mint = modint1000000007;
//const int MOD=998244353;
//using mint = modint998244353;

const int MAX = 510000;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  cout << fixed << setprecision(10);
  
  ll n, h; cin >> n >> h;
  
  vll s;
  for(ll i = 2; i*i <= h; i++){
    if(h % i != 0) continue;
    while(h % i == 0){
      s.eb(i);
      h /= i;
    }
  }
  if(h != 1) s.eb(h);
  //for(auto x: s) cout << x << endl;
  rep(i, n){
    ll a; cin >> a;
    vll ns;
    for(ll x : s){
      if(a%x == 0) a /= x;
      else ns.eb(x);
    }
    if(ns.size())s = ns;
  }
  if(s.empty()) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}
0