結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー SSRS
提出日時 2021-10-29 21:24:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 174,000 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 09:40:44
合計ジャッジ時間 3,000 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  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++){
    if (X % i == 0){
      int 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++){
    if (Y % i == 0){
      int cnt = 0;
      while (Y % i == 0){
        cnt++;
        Y /= i;
      }
      mp2[i] += cnt * B;
    }
  }
  if (Y > 1){
    mp2[Y] += B;
  }
  bool ok = true;
  for (auto P : mp2){
    if (mp1[P.first] < P.second){
      ok = false;
    }
  }
  if (ok){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
0