結果

問題 No.2682 Visible Divisible
ユーザー bortikbortik
提出日時 2024-03-20 21:45:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,427 bytes
コンパイル時間 4,499 ms
コンパイル使用メモリ 275,584 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-03-20 21:46:06
合計ジャッジ時間 8,738 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
13,480 KB
testcase_01 AC 51 ms
6,676 KB
testcase_02 AC 55 ms
6,676 KB
testcase_03 AC 52 ms
6,676 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template<typename T>
bool chmax(T& a, const T& b) {
    bool res = a < b;
    a = max(a, b);
    return res;
}
template<typename T>
bool chmin(T& a, const T& b){
    bool res = a > b;
    a = min(a, b);
    return res;
}

typedef vector<long long> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll>> vll;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;

const int inf = 1000000009;
const ll linf = 4000000000000000009;


// https://trap.jp/post/1224/
template<class... T>
void input(T&... a){
    (cin >> ... >> a);
}

void print(){
    cout << '\n';
}
template<class T, class... Ts>
void print(const T& a, const Ts&... b){
    cout << a;
    (cout << ... << (cout << ' ', b));
    cout << '\n';
}

#define rep1(a)          for(int i = 0; i < a; i++)
#define rep2(i, a)       for(int i = 0; i < a; i++)
#define rep3(i, a, b)    for(int i = a; i < b; i++)
#define rep4(i, a, b, c) for(int i = a; i < b; i += c)
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)


#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
//---------------------------------
template <typename T>
std::vector<std::pair<T, T>> prime_factor(T n) {
    std::vector<std::pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(std::make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(std::make_pair(n, 1));
    return ret;
}

void solve(){
    ll n,k; input(n, k);
    auto kp = prime_factor(k);
    vl p;
    for(const auto [i, j]: kp){
        p.push_back(pow(i, j));
    }
    unordered_set<ll> got;
    rep(i, n){
        ll a; input(a);
        for(auto e: p){
            if(a%e==0) got.insert(e);
        }
    }
    print((got.size()==p.size() ? "Yes" : "No"));
    
}


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

    int t = 1;
    //cin >> t;
    rep(i,0,t) solve();
}
0