結果

問題 No.2379 Burnside's Theorem
ユーザー bortikbortik
提出日時 2023-07-15 01:28:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 924 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 168,260 KB
実行使用メモリ 4,940 KB
最終ジャッジ日時 2023-10-14 15:40:44
合計ジャッジ時間 2,949 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,644 KB
testcase_01 AC 8 ms
4,580 KB
testcase_02 AC 8 ms
4,624 KB
testcase_03 AC 7 ms
4,704 KB
testcase_04 AC 7 ms
4,632 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 7 ms
4,752 KB
testcase_09 WA -
testcase_10 AC 7 ms
4,784 KB
testcase_11 AC 7 ms
4,756 KB
testcase_12 AC 7 ms
4,572 KB
testcase_13 AC 8 ms
4,572 KB
testcase_14 AC 9 ms
4,576 KB
testcase_15 AC 8 ms
4,764 KB
testcase_16 AC 8 ms
4,756 KB
testcase_17 AC 7 ms
4,628 KB
testcase_18 AC 8 ms
4,748 KB
testcase_19 AC 7 ms
4,628 KB
testcase_20 AC 7 ms
4,908 KB
testcase_21 AC 7 ms
4,688 KB
testcase_22 WA -
testcase_23 AC 8 ms
4,776 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;
    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