結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー monnu
提出日時 2021-10-30 09:04:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 3,979 ms
コンパイル使用メモリ 235,108 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-07 13:28:24
合計ジャッジ時間 6,009 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:33:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   33 |   for(auto [p,cnt]:m2){
      |            ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define INF 1000000000
#define MOD 998244353
#define MAX 200000

int main(){
  ll X,A,Y,B;
  cin>>X>>A>>Y>>B;

  map<ll,ll> m1,m2;
  for(ll i=2;i<=1000000;i++){
    while(X%i==0){
      m1[i]+=A;
      X/=i;
    }
    while(Y%i==0){
      m2[i]+=B;
      Y/=i;
    }
  }
  if(X>1){
    m1[X]+=A;
  }
  if(Y>1){
    m2[Y]+=B;
  }

  for(auto [p,cnt]:m2){
    if(cnt>m1[p]){
      cout<<"No"<<'\n';
      return 0;
    }
  }
  cout<<"Yes"<<'\n';
}
0