結果

問題 No.2751 429-like Number
ユーザー HIcoderHIcoder
提出日時 2024-08-18 22:51:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,769 bytes
コンパイル時間 1,505 ms
コンパイル使用メモリ 126,452 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-18 22:51:37
合計ジャッジ時間 12,638 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,948 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 20 ms
6,944 KB
testcase_09 AC 20 ms
6,940 KB
testcase_10 AC 224 ms
6,940 KB
testcase_11 AC 1,323 ms
6,940 KB
testcase_12 WA -
testcase_13 AC 58 ms
6,940 KB
testcase_14 AC 104 ms
6,944 KB
testcase_15 AC 25 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<cassert>
#include<random>
#include<set>
#include<map>
#include<cassert>
#include<unordered_map>
#include<bitset>
#include<numeric>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf=1<<30;
const ll INF=1LL<<62;
typedef pair<int,ll> P;
typedef pair<int,P> PP; 
const ll MOD=998244353;
const int MAXN=100000;

vector<bool> is_prime(MAXN+1,true);

set<ll> st;
vector<ll> prime_list;

void init(){
    is_prime[0]=is_prime[1]=false;
    for(int p=2;p<=MAXN;p++){
        if(is_prime[p]){
            prime_list.push_back(p);
            for(int j=2*p;j<=MAXN;j+=p){
                is_prime[j]=false;
            }
        }
    }

    // cout<<"prime_list.size():"<<prime_list.size()<<endl;

    // for(int i=0;i<prime_list.size();i++){
    //     for(int j=i;j<prime_list.size();j++){
    //         st.insert(prime_list[i]*prime_list[j]);
    //     }
    // }


}

bool solve(){
    ll N;
    cin>>N;
    bool ok=false;
    for(ll d=2;d*d*d<=N;d++){
        if(N%d==0){
            ok=true;
            break;
        }
    }
    if(!ok)return false;
    
    ll c_sum=0;
    vector<pair<ll,ll>> div;
    for(ll d=2;d*d<=N;d++){
        if(N%d==0){
            ll c=0;
            while(N%d==0){
                c++;
                N/=d;
            }       
            c_sum+=c;
            if(c_sum>3) return false;
            div.push_back({d,c});
            
        }
    }
    
    if(c_sum>3){
        return false;
    }

    return true;
    
}

int main(){
    int Q;
    cin>>Q;
    //init();
    vector<bool> ans(Q);
    for(int q=0;q<Q;q++){
        ans[q]=solve();
    }

    for(int q=0;q<Q;q++){
        cout<<(ans[q]?"Yes":"No")<<endl;
    }
}
0