結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー mnmmnm
提出日時 2022-06-12 00:10:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,553 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-23 16:26:13
合計ジャッジ時間 6,902 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 6 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1,028 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

bool is_prime(lint n){
    if(n==2||n==3)    return true;
    if(n<2||n%2==0) return false;
    bool f=true;
    for(lint i=3; i*i<=n; i+=2){
        if(n%i==0){
            f=false; break;
        }
    }
    return f;
}

vector<pair<lint, lint>> prime_factorize(int n){
    vector<pair<lint, lint>> prime_factors; lint p=2, cnt=0;
    while(n>1){
        if(n%p!=0){
            if(cnt!=0){
                prime_factors.push_back(make_pair(p, cnt)); cnt=0;
            }
            do{p++;}while(!is_prime(p));
        }
        else{
            n/=p; cnt++;
        }
    }
    prime_factors.push_back(make_pair(p, cnt));
    return prime_factors;
}

lint div_much(lint num, lint r){
    lint cnt=0;
    while(num%r==0){
        num/=r; cnt++;
    }
    return cnt;
}

int main(void){
    // lint i, j;
    lint n, m;
    lint x, a, y, b;
    in(x);
    in(a);
    in(y);
    in(b);
    vector<pair<lint, lint>> primes_y=prime_factorize(y);
    lint y_i=primes_y.size();
    bool covered=true;
    
    lint i, j=0;
    rep(i,y_i){
        lint n_y, p_y, cnt;
        tie(p_y, n_y)=primes_y[i];
        cnt=div_much(x ,p_y);
        if(cnt*a<n_y*b){
            covered=false;
            break;
        }
    }
    
    covered? out("Yes", endl):out("No", endl);
    return 0;
}
0