結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー Kome_soudouKome_soudou
提出日時 2021-12-15 17:31:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 878 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 171,356 KB
実行使用メモリ 128,360 KB
最終ジャッジ日時 2023-10-01 02:31:17
合計ジャッジ時間 10,006 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 11 ms
5,848 KB
testcase_04 AC 310 ms
60,872 KB
testcase_05 AC 73 ms
18,924 KB
testcase_06 AC 15 ms
7,084 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 83 ms
17,128 KB
testcase_09 AC 7 ms
4,684 KB
testcase_10 AC 87 ms
21,824 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 21 ms
7,128 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 6 ms
4,736 KB
testcase_15 AC 591 ms
89,064 KB
testcase_16 AC 130 ms
24,436 KB
testcase_17 AC 643 ms
96,320 KB
testcase_18 AC 281 ms
45,492 KB
testcase_19 AC 130 ms
29,576 KB
testcase_20 AC 51 ms
14,656 KB
testcase_21 AC 301 ms
49,268 KB
testcase_22 AC 86 ms
17,800 KB
testcase_23 AC 100 ms
24,316 KB
testcase_24 AC 6 ms
4,484 KB
testcase_25 AC 329 ms
49,264 KB
testcase_26 AC 48 ms
14,092 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 356 ms
56,732 KB
testcase_29 AC 200 ms
42,980 KB
testcase_30 AC 450 ms
85,388 KB
testcase_31 AC 248 ms
40,920 KB
testcase_32 AC 44 ms
13,028 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 878 ms
128,360 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template <typename T> map<T, T> prime_factor_power(T n, T a)
{
  map<T, T> ret;
  for(T i = 2; i * i <= n; i++)
  {
    T count = 0;
    while(n % i == 0)
    {
      count += a;
      n /= i;
    }
    
    ret[i] = count;
    if(n == 0) break;
  }
  
  if(n != 1) ret[n] = a;
  return ret;
}

int main()
{
  int64_t X, A, Y, B;
  cin >> X >> A >> Y >> B;
  
  map<int64_t, int64_t> xpf = prime_factor_power(X, A);
  map<int64_t, int64_t> ypf = prime_factor_power(Y, B);
  for(auto y : ypf)
  {
    if(y.second > xpf[y.first])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}
0