結果

問題 No.2682 Visible Divisible
ユーザー cho435cho435
提出日時 2024-03-20 21:25:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 5,679 ms
コンパイル使用メモリ 270,720 KB
実行使用メモリ 18,216 KB
最終ジャッジ日時 2024-03-20 21:25:30
合計ジャッジ時間 11,960 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
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 #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using mint = atcoder::modint998244353;

// divide
map<ll,ll> dv(ll x){
	map<ll,ll> rt;
	for(ll i=2;i*i<=x;i++){
		while(x%i==0){
			rt[i]++;
			x/=i;
		}
	}
	if(x!=1) rt[x]++;
	return rt;
}

int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n);
	rep(i,n) cin>>a.at(i);
	auto dvk=dv(k);
	rep(i,n){
		auto dva=dv(a.at(i));
		for(auto[p,c]:dva){
			if(dvk.count(p)){
				if(dvk.at(p)<=c){
					dvk.erase(p);
				}
			}
		}
	}
	if(dvk.empty()) cout<<"Yes\n";
	else cout<<"No\n";
}
0