結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
proribone
|
| 提出日時 | 2020-10-09 21:29:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 1,000 ms |
| コード長 | 667 bytes |
| コンパイル時間 | 173 ms |
| コンパイル使用メモリ | 81,852 KB |
| 実行使用メモリ | 101,376 KB |
| 最終ジャッジ日時 | 2024-07-20 08:49:17 |
| 合計ジャッジ時間 | 4,585 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
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')
proribone