結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー |
![]() |
提出日時 | 2021-10-29 21:32:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 1,532 bytes |
コンパイル時間 | 1,416 ms |
コンパイル使用メモリ | 121,844 KB |
最終ジャッジ日時 | 2025-01-25 08:32:44 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> #include <tuple> #include <cmath> #include <numeric> #include <functional> #include <cassert> #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; using P = pair<ll, ll>; vector<P> factorize(ll x){ ll y = x; vector<P> ans; for(ll n = 2; n*n <= x; n++){ if(y%n == 0){ ll cnt = 0; while(y%n == 0) { cnt++; y /= n; } ans.push_back(P(n, cnt)); } } if(y != 1) ans.push_back(P(y, 1)); return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; ll x, a, y, b; cin >> x >> a >> y >> b; auto fx = factorize(x); auto fy = factorize(y); map<ll, ll> mp; for(auto [m, c]: fx) { mp[m] = c*a; } for(auto [m, c]: fy){ if(mp.count(m) == 0){ cout << "No" << endl; return 0; } if(c*b > mp[m]){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; }