結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー V_Melville
提出日時 2021-10-30 15:28:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 2,881 ms
コンパイル使用メモリ 250,748 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 13:42:55
合計ジャッジ時間 4,177 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define fi first
#define se second

using std::cin;
using std::cout;
using std::map;
using std::pair;
using ll = long long;

map<ll, int> factorize(ll n) {
	map<ll, int> mp;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		while (n % i == 0) {
			n /= i;
			mp[i]++;
		}
	}
	if (n != 1) mp[n] = 1;
	return mp;
}

int main() {
	ll x, a, y, b;
	cin >> x >> a >> y >> b;
	
	auto f = factorize(x);
	auto g = factorize(y);
	
	bool ok = all_of(g.begin(), g.end(), [&](pair<ll, int> p) {
		return f[p.fi] * a >= p.se * b;
	});
	
	puts(ok ? "Yes" : "No");
	
	return 0;
}
0