結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー Today03Today03
提出日時 2024-03-16 17:45:28
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 779 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 209,076 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 04:29:53
合計ジャッジ時間 4,220 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;

void calc(ll X, ll A, map<ll, ll>& mp) {
    ll nX = X;
    for (ll i = 2; i * i <= nX; i++) {
        if (X % i != 0) {
            continue;
        }
        ll res = 0;
        while (X % i == 0) {
            X /= i;
            res++;
        }
        res *= A;
        mp[i] = res;
    }
    if (X != 1) {
        mp[X] = A;
    }
}

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

    map<ll, ll> mp1, mp2;
    calc(X, A, mp1);
    calc(Y, B, mp2);

    bool ans = true;
    for (auto [k, v] : mp2) {
        if (mp1[k] < v) {
            ans = false;
        }
    }

    puts(ans ? "Yes" : "No");
}
0