結果

問題 No.1250 汝は倍数なりや?
ユーザー proriboneproribone
提出日時 2020-10-09 21:29:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 667 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 110,432 KB
最終ジャッジ日時 2023-09-27 14:45:18
合計ジャッジ時間 6,728 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
72,196 KB
testcase_01 AC 80 ms
72,116 KB
testcase_02 AC 79 ms
72,148 KB
testcase_03 AC 78 ms
72,212 KB
testcase_04 AC 79 ms
71,968 KB
testcase_05 AC 77 ms
71,608 KB
testcase_06 AC 78 ms
71,996 KB
testcase_07 AC 77 ms
72,056 KB
testcase_08 AC 78 ms
71,724 KB
testcase_09 AC 77 ms
72,064 KB
testcase_10 AC 78 ms
72,128 KB
testcase_11 AC 78 ms
72,052 KB
testcase_12 AC 77 ms
71,892 KB
testcase_13 AC 77 ms
71,828 KB
testcase_14 AC 77 ms
71,888 KB
testcase_15 AC 79 ms
71,828 KB
testcase_16 AC 76 ms
71,920 KB
testcase_17 AC 75 ms
72,076 KB
testcase_18 AC 77 ms
71,736 KB
testcase_19 AC 77 ms
71,768 KB
testcase_20 AC 78 ms
72,000 KB
testcase_21 AC 77 ms
72,196 KB
testcase_22 AC 78 ms
72,048 KB
testcase_23 AC 76 ms
71,988 KB
testcase_24 AC 82 ms
77,464 KB
testcase_25 AC 84 ms
77,460 KB
testcase_26 AC 85 ms
77,496 KB
testcase_27 AC 84 ms
77,672 KB
testcase_28 AC 84 ms
77,600 KB
testcase_29 AC 78 ms
71,884 KB
testcase_30 AC 84 ms
77,564 KB
testcase_31 AC 78 ms
71,848 KB
testcase_32 AC 84 ms
77,464 KB
testcase_33 AC 142 ms
110,432 KB
testcase_34 AC 112 ms
92,796 KB
testcase_35 AC 133 ms
103,664 KB
testcase_36 AC 139 ms
106,820 KB
testcase_37 AC 108 ms
93,376 KB
testcase_38 AC 114 ms
94,968 KB
testcase_39 AC 116 ms
92,972 KB
testcase_40 AC 115 ms
93,032 KB
testcase_41 AC 110 ms
97,928 KB
testcase_42 AC 106 ms
88,012 KB
testcase_43 AC 129 ms
105,796 KB
testcase_44 AC 104 ms
87,872 KB
testcase_45 AC 137 ms
106,896 KB
testcase_46 AC 97 ms
84,552 KB
testcase_47 AC 121 ms
95,192 KB
testcase_48 AC 83 ms
71,656 KB
testcase_49 AC 81 ms
76,668 KB
testcase_50 AC 79 ms
71,996 KB
testcase_51 AC 84 ms
76,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter,defaultdict

def factorization(n):
    dic=defaultdict(int)
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            dic[i]+=cnt
    if(tmp!=1):
        dic[tmp]+=1
    return dic

N,H=map(int,input().split())
A=list(map(int,input().split()))

arr=factorization(H)

for i in range(N):
    for x in arr.keys():
        while(arr[x]>0 and A[i]%x==0):
            A[i]//=x
            arr[x]-=1
isok=True
for y in arr.values():
    if y!=0:
        isok=False
        break
if isok:
    print('YES')
else:
    print('NO')
0