結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー 👑 KazunKazun
提出日時 2021-09-27 20:34:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,098 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 82,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 13:44:21
合計ジャッジ時間 2,186 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 5 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 5 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 5 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 5 ms
5,376 KB
testcase_29 AC 4 ms
5,376 KB
testcase_30 AC 7 ms
5,376 KB
testcase_31 AC 4 ms
5,376 KB
testcase_32 AC 3 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 9 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 AC 2 ms
5,376 KB
testcase_46 AC 2 ms
5,376 KB
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 2 ms
5,376 KB
testcase_49 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>

using namespace std;
using ll=long long;

vector<pair<ll,ll>> Prime_Factorization(ll N) {
    vector<pair<ll,ll>> R;
    ll e=0;

    while (N%2==0){
        e++;
        N/=2;
    }
    R.push_back({2,e});

    e=0;
    while (N%3==0){
        e++;
        N/=3;
    }
    R.push_back({3,e});

    ll p=5,f=0;
    while (p*p<=N) {
        if (N % p==0){
            ll e=0;
            while (N % p == 0){
                e++;
                N/=p;
            }

            R.push_back({p,e});
        }

        p+=2+2*f;
        f^=1;
    }

    if (N != 1) R.push_back({N, 1});

    return R;
}

int main(){
    ll A,B,X,Y;
    cin >> X >> A >> Y >> B;

    vector<pair<ll,ll>> P=Prime_Factorization(X);
    vector<pair<ll,ll>> Q=Prime_Factorization(Y);

    map<ll,ll> D,E;

    for (auto p: P){D[p.first]=A*p.second;}
    for (auto q: Q){E[q.first]=B*q.second;}

    for (auto q: E){
        if (D[q.first]<E[q.first]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}
0