結果

問題 No.2379 Burnside's Theorem
ユーザー bortikbortik
提出日時 2023-07-15 01:25:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 858 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 167,148 KB
実行使用メモリ 5,004 KB
最終ジャッジ日時 2023-10-14 15:38:21
合計ジャッジ時間 2,487 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,636 KB
testcase_01 AC 7 ms
4,664 KB
testcase_02 AC 7 ms
4,624 KB
testcase_03 AC 7 ms
4,580 KB
testcase_04 AC 6 ms
4,640 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 7 ms
4,616 KB
testcase_09 WA -
testcase_10 AC 6 ms
4,756 KB
testcase_11 AC 7 ms
4,776 KB
testcase_12 AC 6 ms
4,732 KB
testcase_13 AC 7 ms
4,584 KB
testcase_14 AC 8 ms
4,620 KB
testcase_15 AC 7 ms
4,752 KB
testcase_16 AC 8 ms
4,756 KB
testcase_17 AC 7 ms
4,620 KB
testcase_18 AC 7 ms
4,752 KB
testcase_19 AC 7 ms
4,612 KB
testcase_20 AC 7 ms
4,808 KB
testcase_21 AC 7 ms
4,632 KB
testcase_22 AC 6 ms
4,924 KB
testcase_23 AC 7 ms
4,760 KB
権限があれば一括ダウンロードができます

ソースコード

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;
    sieve();
    for(int x : primes){
        if(n % x == 0) cnt++;
        if(cnt >= 3){
            cout << "No";
            return;
        }
        if(x*x > n){
            cout << "Yes";
            return;
        }
    }
    cout << "Yes";
}

int main(){

    solve();

    return 0;
}
0