結果

問題 No.1250 汝は倍数なりや?
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-09 22:09:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 122,344 KB
最終ジャッジ日時 2023-09-27 17:28:25
合計ジャッジ時間 26,125 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
89,136 KB
testcase_01 AC 122 ms
88,836 KB
testcase_02 AC 124 ms
88,948 KB
testcase_03 AC 124 ms
89,036 KB
testcase_04 AC 122 ms
89,040 KB
testcase_05 AC 124 ms
89,084 KB
testcase_06 AC 123 ms
88,956 KB
testcase_07 AC 124 ms
88,968 KB
testcase_08 AC 125 ms
88,952 KB
testcase_09 AC 124 ms
88,952 KB
testcase_10 AC 124 ms
89,164 KB
testcase_11 AC 123 ms
89,044 KB
testcase_12 AC 125 ms
89,040 KB
testcase_13 AC 129 ms
89,036 KB
testcase_14 AC 124 ms
88,956 KB
testcase_15 AC 126 ms
89,188 KB
testcase_16 AC 126 ms
89,236 KB
testcase_17 AC 127 ms
89,252 KB
testcase_18 AC 126 ms
89,252 KB
testcase_19 AC 126 ms
88,960 KB
testcase_20 AC 126 ms
89,112 KB
testcase_21 WA -
testcase_22 AC 128 ms
89,120 KB
testcase_23 AC 165 ms
91,012 KB
testcase_24 AC 157 ms
90,480 KB
testcase_25 AC 162 ms
90,948 KB
testcase_26 AC 136 ms
90,012 KB
testcase_27 AC 161 ms
91,100 KB
testcase_28 AC 155 ms
90,464 KB
testcase_29 AC 142 ms
90,324 KB
testcase_30 AC 167 ms
91,180 KB
testcase_31 AC 142 ms
90,548 KB
testcase_32 AC 170 ms
90,948 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 AC 797 ms
100,548 KB
testcase_43 TLE -
testcase_44 AC 795 ms
100,248 KB
testcase_45 TLE -
testcase_46 AC 651 ms
96,720 KB
testcase_47 TLE -
testcase_48 AC 121 ms
89,108 KB
testcase_49 AC 120 ms
89,052 KB
testcase_50 AC 122 ms
89,212 KB
testcase_51 AC 120 ms
88,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from collections import Counter
def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0]
primes = prime_numbers(10 ** 6)
def soinnsuu(x):
    l = []
    for i in primes:
        if i > int(math.sqrt(x)) + 1:
            break
        elif x % i == 0:
            while x % i == 0:
                x //= i
                l.append(i)
    if not x == 1:
        l.append(x)
    return Counter(l)
n, h = map(int, input().split())
h = dict(soinnsuu(h))
a = list(map(int, input().split()))
if 0 in a:
    exit(print("NO"))
for i in a:
    for j, k in dict(soinnsuu(abs(i))).items():
        try:
            h[j] -= k
            h[j] = max(0, h[j])
        except:
            pass
if all(i == 0 for i in h.values()):
    print("YES")
else:
    print("NO")
0