結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2020-10-09 21:30:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 81,832 KB |
| 実行使用メモリ | 68,312 KB |
| 最終ジャッジ日時 | 2024-07-20 08:50:16 |
| 合計ジャッジ時間 | 4,061 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 TLE * 1 -- * 30 |
ソースコード
n,h = map(int, input().split())
A = list(map(int, input().split()))
import math
def factorize(n):
d = {}
temp = int(math.sqrt(n))+1
for i in range(2, temp):
while n%i== 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
d[n] += 1
elif n != 1:
d[n] =1
return d
d = factorize(h)
from collections import defaultdict
c = defaultdict(lambda:0)
for a in A:
a = abs(a)
for k in d.keys():
cnt = 0
while a%k == 0:
a //= k
cnt += 1
c[k] += cnt
#print(c)
#print(d)
for k, v in d.items():
if v > c[k]:
print('NO')
exit()
else:
print('YES')
brthyyjp