結果

問題 No.2682 Visible Divisible
ユーザー otoshigootoshigo
提出日時 2024-03-20 21:35:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 77,572 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-20 21:35:13
合計ジャッジ時間 3,150 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
6,548 KB
testcase_01 AC 88 ms
6,548 KB
testcase_02 AC 83 ms
6,548 KB
testcase_03 AC 88 ms
6,548 KB
testcase_04 AC 57 ms
6,548 KB
testcase_05 AC 66 ms
6,548 KB
testcase_06 AC 76 ms
6,548 KB
testcase_07 AC 82 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 79 ms
6,548 KB
testcase_12 AC 77 ms
6,548 KB
testcase_13 AC 72 ms
6,548 KB
testcase_14 AC 82 ms
6,548 KB
testcase_15 AC 71 ms
6,548 KB
testcase_16 AC 62 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    ll K;
    cin>>N>>K;
    vector<ll>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    for(int i=0;i<N;i++){
        ll g=gcd(K,A[i]);
        if(g>1){
            for(int j=0;j<N;j++){
                if(A[j]%g==0)A[j]/=g;
            }
            K/=g;
        }
    }
    cout<<(K==1?"Yes":"No")<<"\n";
}
0