結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー | yassu0320 |
提出日時 | 2021-11-04 23:25:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 131 ms / 2,000 ms |
コード長 | 1,532 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 80,384 KB |
最終ジャッジ日時 | 2024-04-23 06:11:56 |
合計ジャッジ時間 | 6,781 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 101 ms
80,000 KB |
testcase_01 | AC | 95 ms
80,128 KB |
testcase_02 | AC | 96 ms
80,128 KB |
testcase_03 | AC | 98 ms
80,128 KB |
testcase_04 | AC | 118 ms
80,384 KB |
testcase_05 | AC | 105 ms
80,256 KB |
testcase_06 | AC | 102 ms
80,380 KB |
testcase_07 | AC | 98 ms
80,256 KB |
testcase_08 | AC | 101 ms
80,256 KB |
testcase_09 | AC | 97 ms
80,256 KB |
testcase_10 | AC | 102 ms
80,096 KB |
testcase_11 | AC | 96 ms
80,128 KB |
testcase_12 | AC | 99 ms
80,384 KB |
testcase_13 | AC | 100 ms
80,256 KB |
testcase_14 | AC | 100 ms
80,256 KB |
testcase_15 | AC | 123 ms
80,128 KB |
testcase_16 | AC | 105 ms
80,000 KB |
testcase_17 | AC | 121 ms
80,384 KB |
testcase_18 | AC | 108 ms
80,256 KB |
testcase_19 | AC | 105 ms
80,128 KB |
testcase_20 | AC | 103 ms
80,128 KB |
testcase_21 | AC | 109 ms
80,248 KB |
testcase_22 | AC | 104 ms
80,256 KB |
testcase_23 | AC | 107 ms
80,128 KB |
testcase_24 | AC | 98 ms
80,128 KB |
testcase_25 | AC | 112 ms
80,160 KB |
testcase_26 | AC | 99 ms
80,384 KB |
testcase_27 | AC | 98 ms
80,128 KB |
testcase_28 | AC | 111 ms
80,256 KB |
testcase_29 | AC | 110 ms
80,256 KB |
testcase_30 | AC | 120 ms
80,128 KB |
testcase_31 | AC | 107 ms
80,256 KB |
testcase_32 | AC | 100 ms
80,256 KB |
testcase_33 | AC | 100 ms
79,744 KB |
testcase_34 | AC | 96 ms
79,936 KB |
testcase_35 | AC | 96 ms
80,280 KB |
testcase_36 | AC | 131 ms
80,000 KB |
testcase_37 | AC | 96 ms
79,744 KB |
testcase_38 | AC | 98 ms
80,128 KB |
testcase_39 | AC | 100 ms
80,000 KB |
testcase_40 | AC | 96 ms
80,000 KB |
testcase_41 | AC | 95 ms
80,000 KB |
testcase_42 | AC | 102 ms
80,000 KB |
testcase_43 | AC | 97 ms
79,744 KB |
testcase_44 | AC | 98 ms
80,000 KB |
testcase_45 | AC | 98 ms
79,744 KB |
testcase_46 | AC | 95 ms
79,744 KB |
testcase_47 | AC | 98 ms
80,000 KB |
testcase_48 | AC | 99 ms
80,276 KB |
testcase_49 | AC | 96 ms
80,128 KB |
ソースコード
#!/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 for k in set(f1) | set(f2): f1[k] = f1.get(k, 0) f2[k] = f2.get(k, 0) res = True for k in f2: res &= f1[k] >= f2[k] if res: print('Yes') else: print('No')