結果

問題 No.2682 Visible Divisible
ユーザー umezoumezo
提出日時 2024-03-21 01:37:57
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 3,060 ms
コンパイル使用メモリ 247,808 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-21 01:38:03
合計ジャッジ時間 5,104 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
6,676 KB
testcase_01 AC 76 ms
6,676 KB
testcase_02 AC 74 ms
6,676 KB
testcase_03 AC 88 ms
6,676 KB
testcase_04 AC 40 ms
6,676 KB
testcase_05 AC 50 ms
6,676 KB
testcase_06 AC 63 ms
6,676 KB
testcase_07 AC 72 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 68 ms
6,676 KB
testcase_12 AC 68 ms
6,676 KB
testcase_13 AC 66 ms
6,676 KB
testcase_14 AC 65 ms
6,676 KB
testcase_15 AC 61 ms
6,676 KB
testcase_16 AC 43 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,k;
  cin>>n>>k;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  rep(i,n){
    if(k==1) break;
    if(A[i]==1) continue;
    ll g=gcd(k,A[i]);
    if(g==1) continue;
    k/=g;
    for(int j=i;j<n;j++) if(A[j]%g==0) A[j]/=g;
  }
  if(k==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    
  return 0;
}
0