結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー erbowl
提出日時 2022-08-20 10:29:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 950 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 202,632 KB
最終ジャッジ日時 2025-01-31 01:59:05
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;

#include <bits/stdc++.h>
using namespace std;
#define int long long


vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

signed main(){
    ll x,a,y,b;
    std::cin >> x>>a>>y>>b;
    auto xxe = prime_factorize(x);
    map<ll,ll> xe,ye;
    for (auto e : xxe) {
        xe[e.first] = e.second;
    }
    auto yye = prime_factorize(y);
    for (auto e : yye) {
        ye[e.first] = e.second;
    }
    for (auto e : ye) {
        if(xe[e.first]*a<e.second*b){
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;
}
0