結果

問題 No.2682 Visible Divisible
ユーザー cho435cho435
提出日時 2024-03-21 20:40:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 4,431 ms
コンパイル使用メモリ 262,468 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-21 20:40:24
合計ジャッジ時間 9,246 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 247 ms
6,676 KB
testcase_01 AC 245 ms
6,676 KB
testcase_02 AC 250 ms
6,676 KB
testcase_03 AC 248 ms
6,676 KB
testcase_04 AC 246 ms
6,676 KB
testcase_05 AC 248 ms
6,676 KB
testcase_06 AC 242 ms
6,676 KB
testcase_07 AC 240 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 AC 248 ms
6,676 KB
testcase_12 AC 251 ms
6,676 KB
testcase_13 AC 240 ms
6,676 KB
testcase_14 AC 248 ms
6,676 KB
testcase_15 AC 240 ms
6,676 KB
testcase_16 AC 240 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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;

ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n);
	rep(i,n) cin>>a.at(i);
	rep(i,n) a.at(i)=gcd(a.at(i),k);
	ll lm=a.at(0);
	rep(i,n) lm=lm/gcd(lm,a.at(i))*a.at(i);
	if(lm!=k) cout<<"No\n";
	else cout<<"Yes\n";
}
0