結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-23 19:47:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,896 KB
最終ジャッジ日時 2023-09-14 12:50:51
合計ジャッジ時間 7,058 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,896 KB
testcase_01 AC 20 ms
8,772 KB
testcase_02 AC 19 ms
8,864 KB
testcase_03 AC 89 ms
8,896 KB
testcase_04 AC 160 ms
8,748 KB
testcase_05 AC 116 ms
8,824 KB
testcase_06 AC 117 ms
8,864 KB
testcase_07 AC 99 ms
8,864 KB
testcase_08 AC 187 ms
8,728 KB
testcase_09 AC 104 ms
8,756 KB
testcase_10 AC 158 ms
8,760 KB
testcase_11 AC 110 ms
8,868 KB
testcase_12 AC 137 ms
8,724 KB
testcase_13 AC 137 ms
8,812 KB
testcase_14 AC 52 ms
8,812 KB
testcase_15 AC 131 ms
8,716 KB
testcase_16 AC 155 ms
8,820 KB
testcase_17 AC 141 ms
8,752 KB
testcase_18 AC 156 ms
8,756 KB
testcase_19 AC 123 ms
8,720 KB
testcase_20 AC 91 ms
8,812 KB
testcase_21 AC 126 ms
8,896 KB
testcase_22 AC 109 ms
8,884 KB
testcase_23 AC 160 ms
8,764 KB
testcase_24 AC 90 ms
8,764 KB
testcase_25 AC 169 ms
8,840 KB
testcase_26 AC 150 ms
8,864 KB
testcase_27 AC 129 ms
8,808 KB
testcase_28 AC 141 ms
8,724 KB
testcase_29 AC 157 ms
8,812 KB
testcase_30 AC 175 ms
8,820 KB
testcase_31 AC 141 ms
8,720 KB
testcase_32 AC 155 ms
8,768 KB
testcase_33 AC 126 ms
8,760 KB
testcase_34 AC 126 ms
8,896 KB
testcase_35 AC 125 ms
8,708 KB
testcase_36 AC 187 ms
8,712 KB
testcase_37 AC 18 ms
8,560 KB
testcase_38 AC 19 ms
8,476 KB
testcase_39 AC 19 ms
8,616 KB
testcase_40 AC 71 ms
8,716 KB
testcase_41 AC 19 ms
8,820 KB
testcase_42 AC 19 ms
8,736 KB
testcase_43 AC 19 ms
8,812 KB
testcase_44 AC 19 ms
8,720 KB
testcase_45 AC 72 ms
8,892 KB
testcase_46 AC 87 ms
8,864 KB
testcase_47 AC 98 ms
8,820 KB
testcase_48 AC 18 ms
8,684 KB
testcase_49 AC 48 ms
8,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
x,a,y,b=map(int,input().split())
if y==1:
    print('Yes')
    exit()
X=factorization(x)
dx=defaultdict(int)
dy=defaultdict(int)
Y=factorization(y)
for key,val in X:
    dx[key]=val*a
for key,val in Y:
    dy[key]=val*b
for key,val in dy.items():
    if key not in dx:
        print('No')
        exit()
    dx[key]-=val
    if dx[key]<0:
        print('No')
        exit()
print('Yes')
0