結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー mkawa2mkawa2
提出日時 2021-10-29 21:30:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 1,483 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-16 14:09:49
合計ジャッジ時間 4,409 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 35 ms
10,752 KB
testcase_04 AC 121 ms
10,880 KB
testcase_05 AC 56 ms
10,752 KB
testcase_06 AC 38 ms
10,624 KB
testcase_07 AC 32 ms
10,624 KB
testcase_08 AC 54 ms
10,880 KB
testcase_09 AC 37 ms
10,752 KB
testcase_10 AC 60 ms
10,880 KB
testcase_11 AC 32 ms
10,880 KB
testcase_12 AC 38 ms
10,624 KB
testcase_13 AC 32 ms
10,624 KB
testcase_14 AC 34 ms
10,880 KB
testcase_15 AC 163 ms
10,624 KB
testcase_16 AC 67 ms
10,624 KB
testcase_17 AC 176 ms
10,880 KB
testcase_18 AC 96 ms
10,624 KB
testcase_19 AC 72 ms
10,752 KB
testcase_20 AC 49 ms
10,624 KB
testcase_21 AC 101 ms
10,752 KB
testcase_22 AC 53 ms
10,880 KB
testcase_23 AC 64 ms
10,752 KB
testcase_24 AC 33 ms
10,624 KB
testcase_25 AC 103 ms
10,752 KB
testcase_26 AC 49 ms
10,880 KB
testcase_27 AC 35 ms
10,880 KB
testcase_28 AC 115 ms
10,752 KB
testcase_29 AC 91 ms
10,624 KB
testcase_30 AC 158 ms
10,624 KB
testcase_31 AC 91 ms
10,752 KB
testcase_32 AC 48 ms
10,752 KB
testcase_33 AC 33 ms
10,624 KB
testcase_34 AC 32 ms
10,752 KB
testcase_35 AC 32 ms
10,880 KB
testcase_36 AC 225 ms
10,752 KB
testcase_37 AC 32 ms
10,624 KB
testcase_38 AC 33 ms
10,624 KB
testcase_39 AC 32 ms
10,624 KB
testcase_40 AC 31 ms
10,880 KB
testcase_41 AC 31 ms
10,624 KB
testcase_42 AC 33 ms
10,880 KB
testcase_43 AC 32 ms
10,624 KB
testcase_44 AC 32 ms
10,624 KB
testcase_45 AC 32 ms
10,752 KB
testcase_46 AC 33 ms
10,624 KB
testcase_47 AC 32 ms
10,752 KB
testcase_48 AC 31 ms
10,880 KB
testcase_49 AC 31 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 1 << 63
# md = 998244353
md = 10**9+7

# (底,指数)を返す
# 18=2**1 * 3**2なので[(2,1),(3,2)]
def PrimeFactorization(x):
    def plist(x):
        if x < 2: return []
        if x & 1 == 0: return [2]+plist(x >> 1)
        for p in range(3, x+1, 2):
            if x%p == 0: return [p]+plist(x//p)
            if p**2 > x: return [x]

    pl = plist(x)
    pp, ee = [], []
    for p in pl:
        if not pp or p != pp[-1]:
            pp += [p]
            ee += [0]
        ee[-1] += 1
    return pp, ee

from collections import Counter

x, a, y, b = LI()

def cntp(a):
    ca = Counter()
    pp, ee = PrimeFactorization(a)
    for p, e in zip(pp, ee):
        ca[p] = e
    return ca

def solve():
    cx = cntp(x)
    cy = cntp(y)

    for p, e in cy.items():
        if e*b > cx[p]*a: return False
    return True

print("Yes" if solve() else "No")
0