結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2021-10-29 22:41:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 76,492 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-04-16 15:30:12
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
18,816 KB
testcase_01 AC 29 ms
18,944 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 30 ms
18,832 KB
testcase_04 AC 30 ms
18,832 KB
testcase_05 AC 30 ms
18,876 KB
testcase_06 AC 31 ms
18,892 KB
testcase_07 AC 29 ms
18,816 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 31 ms
18,816 KB
testcase_10 AC 29 ms
18,816 KB
testcase_11 AC 30 ms
18,880 KB
testcase_12 AC 30 ms
18,816 KB
testcase_13 AC 31 ms
18,896 KB
testcase_14 AC 30 ms
18,816 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 31 ms
18,816 KB
testcase_18 AC 32 ms
19,072 KB
testcase_19 AC 29 ms
18,816 KB
testcase_20 AC 30 ms
18,944 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 30 ms
18,944 KB
testcase_23 AC 30 ms
18,816 KB
testcase_24 AC 31 ms
18,944 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 30 ms
18,816 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 31 ms
18,816 KB
testcase_29 AC 29 ms
18,812 KB
testcase_30 AC 30 ms
18,944 KB
testcase_31 AC 32 ms
18,944 KB
testcase_32 AC 30 ms
18,816 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 29 ms
18,816 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 29 ms
18,880 KB
testcase_41 AC 29 ms
18,816 KB
testcase_42 AC 30 ms
18,816 KB
testcase_43 AC 31 ms
18,944 KB
testcase_44 AC 30 ms
18,836 KB
testcase_45 AC 32 ms
18,816 KB
testcase_46 AC 31 ms
19,004 KB
testcase_47 AC 30 ms
18,980 KB
testcase_48 AC 33 ms
18,912 KB
testcase_49 AC 31 ms
18,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    long long x, y, a, b;
    cin >> x >> a >> y >> b;
    if (y == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    if (x == y && a >= b) {
        cout << "Yes" << endl;
        return 0;
    }
    long long x_ = x;
    long long y_ = y;
    vector<long long> cnt_x(1000000, 0), cnt_y(1000000, 0);
    for (long long i = 2; i < 1000000; i++) {
        while (x % i == 0) {
            x /= i;
            cnt_x[i]++;
        }
    }
    for (long long i = 2; i < 1000000; i++) {
        while (y % i == 0) {
            y /= i;
            cnt_y[i]++;
        }
    }
    if (x % y != 0) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 2; i < 1000000; i++) {
        if (cnt_x[i] * a < cnt_y[i] * b) {
            cout << "No" << endl;
            //cout << i << endl;
            return 0;
        }
    }
    if (y != 1 && a < b) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}
0