結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー lloyz
提出日時 2021-11-06 23:46:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-07 23:29:25
合計ジャッジ時間 7,978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

x, a, y, b = map(int, input().split())

from collections import defaultdict
def prime_factorize(n):
    prime_dict = defaultdict(int)
    n_c = n
    while n % 2 == 0:
        prime_dict[2] += 1
        n //= 2
    f = 3
    while f * f <= n_c:
        while n % f == 0:
            prime_dict[f] += 1
            n //= f
        f += 2
    if n != 1:
        prime_dict[n] += 1
    return prime_dict

x_prime = prime_factorize(x)
y_prime = prime_factorize(y)
x_prime_set = set([prime for prime in x_prime.keys()])
y_prime_set = set([prime for prime in y_prime.keys()])
if x_prime_set & y_prime_set != y_prime_set:
    print("No")
    exit()

for prime in x_prime.keys():
    if x_prime[prime] * a < y_prime[prime] * b:
        print("No")
        exit()
print("Yes")
0