結果

問題 No.2379 Burnside's Theorem
ユーザー bortikbortik
提出日時 2023-07-15 01:48:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 1,725 ms
コンパイル使用メモリ 169,808 KB
実行使用メモリ 19,316 KB
最終ジャッジ日時 2024-09-16 10:28:23
合計ジャッジ時間 4,573 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
18,928 KB
testcase_01 AC 80 ms
17,396 KB
testcase_02 AC 83 ms
17,400 KB
testcase_03 AC 80 ms
17,908 KB
testcase_04 AC 90 ms
17,396 KB
testcase_05 AC 88 ms
17,776 KB
testcase_06 AC 87 ms
19,060 KB
testcase_07 AC 94 ms
18,928 KB
testcase_08 AC 89 ms
19,316 KB
testcase_09 AC 88 ms
18,288 KB
testcase_10 AC 91 ms
18,160 KB
testcase_11 AC 83 ms
18,672 KB
testcase_12 AC 87 ms
18,164 KB
testcase_13 AC 104 ms
18,680 KB
testcase_14 AC 105 ms
18,420 KB
testcase_15 AC 97 ms
18,160 KB
testcase_16 AC 83 ms
18,288 KB
testcase_17 AC 90 ms
18,544 KB
testcase_18 AC 89 ms
17,780 KB
testcase_19 AC 83 ms
18,160 KB
testcase_20 AC 91 ms
17,656 KB
testcase_21 AC 79 ms
18,420 KB
testcase_22 AC 83 ms
18,804 KB
testcase_23 AC 95 ms
18,160 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[10000001] = {};
void sieve(){
    for(int i = 2; i < 10000001; i++){
        if(!f[i]){
            primes.push_back(i);
            int j = 2;
            while(j*i < 10000001){
                f[j*i] = true;
                j++;
            }
        }
    }
}

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

int main(){

    solve();

    return 0;
}
0