結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー mmn15277198
提出日時 2021-10-30 08:14:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 859 ms / 2,000 ms
コード長 917 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 101,116 KB
実行使用メモリ 128,512 KB
最終ジャッジ日時 2024-10-07 13:27:04
合計ジャッジ時間 7,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstdio>

using namespace std;

int main() {
  //SSRSさんの写し
  long long x , a , y , b;
  cin >> x >> a >> y >> b;
  map<long long , long long> mp1;
  for (long long i = 2; i * i <= x; i++) {
    long long cnt = 0;
    while (x % i == 0) {
      cnt++;
      x /= i;
    }
    mp1[i] = cnt * a;
  }
  if (x > 1) {
    mp1[x] = a;
  }

  map<long long , long long> mp2;
  for (long long i = 2; i * i <= y; i++) {
    long long cnt = 0;
    while (y % i == 0) {
      cnt++;
      y /= i;
    }
    mp2[i] = cnt * b;
  }
  if (y > 1) {
    mp2[y] = b;
  }

  bool ok = true;
  for (auto i : mp2) {
    if (mp1[i.first] >= i.second) continue;
    ok = false;
  }

  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
0