結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー yassu0320yassu0320
提出日時 2021-11-04 23:19:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,503 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 80,680 KB
最終ジャッジ日時 2024-04-23 06:06:35
合計ジャッジ時間 6,104 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
80,000 KB
testcase_01 AC 89 ms
79,872 KB
testcase_02 AC 85 ms
80,136 KB
testcase_03 AC 82 ms
80,124 KB
testcase_04 AC 97 ms
80,000 KB
testcase_05 AC 92 ms
80,256 KB
testcase_06 AC 83 ms
80,124 KB
testcase_07 AC 83 ms
80,256 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 88 ms
80,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 90 ms
80,512 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 83 ms
80,000 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 131 ms
80,000 KB
testcase_37 AC 84 ms
79,872 KB
testcase_38 AC 84 ms
80,128 KB
testcase_39 AC 84 ms
80,000 KB
testcase_40 AC 93 ms
80,384 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 84 ms
80,128 KB
testcase_44 WA -
testcase_45 AC 82 ms
80,128 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 81 ms
80,000 KB
testcase_49 AC 82 ms
80,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

from pprint import pprint
from sys import setrecursionlimit, stdin
from typing import Dict, Iterable, Set

INF: int = 1 << 62
setrecursionlimit(1_000_000)


def inputs(type_=int):
    ins = input().split(' ')
    ins = [x for x in ins if x != '']

    if isinstance(type_, Iterable):
        return [t(x) for t, x in zip(type_, ins)]
    else:
        return list(map(type_, ins))


def input_(type_=int):
    a, = inputs(type_)
    return a


inputi = input_


def inputstr():
    return input_(str)


def answer(res) -> None:
    print(res)
    exit()


# start coding
def get_one_factor(n: int, start: int = 2) -> int:
    """
    一つの素因数を計算する
    計算量は O(sqrt(n))
    """
    i = start
    while i * i <= n:
        if n % i == 0:
            return i
        i += 1

    return n


def compute_factors(n: int):
    """
    素因数分解を計算する
    計算量は O(sqrt(n)log(n))
    """
    assert n >= 1

    if n == 1:
        return {}

    d = {}
    start = 2
    while n > 1:
        k = get_one_factor(n, start)
        start = k
        count = 0
        while n % k == 0:
            n //= k
            count += 1

        d[k] = count

    return d

x, a, y, b = inputs()
f1 = compute_factors(x)
for k in f1:
    f1[k] *= a

f2 = compute_factors(y)
for k in f2:
    f2[k] *= b

res = True
for k in f2:
    if k in f1:
        res &= f2[k] >= f1[k]
    else:
        res = False

if res:
    print('Yes')
else:
    print('No')
0