結果

問題 No.1250 汝は倍数なりや?
ユーザー souta-1326souta-1326
提出日時 2020-11-02 22:14:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 913 bytes
コンパイル時間 1,264 ms
コンパイル使用メモリ 171,704 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 13:53:07
合計ジャッジ時間 3,673 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 31 ms
4,380 KB
testcase_34 AC 25 ms
4,376 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 15 ms
4,380 KB
testcase_38 AC 15 ms
4,380 KB
testcase_39 AC 22 ms
4,376 KB
testcase_40 AC 21 ms
4,376 KB
testcase_41 AC 17 ms
4,380 KB
testcase_42 AC 13 ms
4,376 KB
testcase_43 AC 30 ms
4,380 KB
testcase_44 AC 11 ms
4,376 KB
testcase_45 AC 26 ms
4,376 KB
testcase_46 AC 11 ms
4,380 KB
testcase_47 AC 21 ms
4,380 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,380 KB
testcase_51 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
//#include"atcoder/all"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(a) (a).begin(),(a).end()
using namespace std;
//using namespace atcoder;
typedef long long ll;
int main(){
  ll N,H,i,j,a;scanf("%lld%lld",&N,&H);
  vector<pair<ll,ll>> Hc;
  for(i=2;i<100000;i++){
    if(H%i) continue;
    Hc.emplace_back(make_pair(i,0));
    while(H%i == 0){
      Hc.back().second++;H /= i;
    }
  }
  vector<ll> Ac(Hc.size());
  for(i=0;i<N;i++){
    scanf("%lld",&a);a = abs(a);
    if(a == 0){
        printf("YES\n");return 0;
    }
    for(j=0;j<Hc.size();j++){
      while(a%Hc[j].first == 0){
        Ac[j]++;a /= Hc[j].first;
      }
    }
    if(a == H) H == 1;
  }
  if(H != 1){
    printf("NO\n");return 0;
  }
  for(i=0;i<Hc.size();i++){
    if(Hc[i].second > Ac[i]){
      printf("NO\n");return 0;
    }
  }
  printf("YES\n");
}
0