結果

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

テストケース

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

ソースコード

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(){
	int n,k;
	cin>>n>>k;
	vector<int> 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