結果

問題 No.2379 Burnside's Theorem
ユーザー bortikbortik
提出日時 2023-07-15 01:48:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 166,136 KB
実行使用メモリ 19,148 KB
最終ジャッジ日時 2023-10-14 16:04:14
合計ジャッジ時間 5,561 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
18,196 KB
testcase_01 AC 111 ms
17,700 KB
testcase_02 AC 108 ms
18,080 KB
testcase_03 AC 106 ms
18,292 KB
testcase_04 AC 116 ms
17,700 KB
testcase_05 AC 112 ms
17,560 KB
testcase_06 AC 111 ms
17,164 KB
testcase_07 AC 110 ms
17,780 KB
testcase_08 AC 112 ms
18,268 KB
testcase_09 AC 112 ms
19,148 KB
testcase_10 AC 112 ms
17,336 KB
testcase_11 AC 107 ms
18,376 KB
testcase_12 AC 123 ms
17,292 KB
testcase_13 AC 123 ms
17,284 KB
testcase_14 AC 115 ms
16,856 KB
testcase_15 AC 118 ms
17,168 KB
testcase_16 AC 108 ms
17,324 KB
testcase_17 AC 117 ms
17,232 KB
testcase_18 AC 117 ms
17,700 KB
testcase_19 AC 117 ms
17,904 KB
testcase_20 AC 111 ms
17,936 KB
testcase_21 AC 112 ms
17,908 KB
testcase_22 AC 110 ms
17,988 KB
testcase_23 AC 109 ms
17,696 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