結果

問題 No.2379 Burnside's Theorem
ユーザー bortik
提出日時 2023-07-15 01:28:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 924 bytes
コンパイル時間 1,550 ms
コンパイル使用メモリ 168,532 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 10:08:05
合計ジャッジ時間 2,512 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, n, a) for (int i = (int)(n); i >= (int)(a); i--)

vector<int> primes;
bool f[1000001] = {};
void sieve(){
    primes.push_back(2);
    for(int i = 3; i < 1000001; i+=2){
        if(!f[i]){
            primes.push_back(i);
            int j = 2;
            while(j*i < 1000001){
                f[j*i] = true;
                j++;
            }
        }
    }
}

void solve(){
    ll n; cin >> n;
    int cnt = 0;
    if(n == 1){
        cout << "No";
        return;
    }
    sieve();
    for(int x : primes){
        if(n % x == 0) cnt++;
        if(cnt >= 3){
            cout << "No";
            return;
        }
        if((ll)(x*x) > n){
            cout << "Yes";
            return;
        }
    }
    cout << "Yes";
}

int main(){

    solve();

    return 0;
}
0