結果

問題 No.2379 Burnside's Theorem
ユーザー kpinkcatkpinkcat
提出日時 2023-10-03 01:15:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,102 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 200,412 KB
実行使用メモリ 11,416 KB
最終ジャッジ日時 2023-10-03 01:15:05
合計ジャッジ時間 4,156 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 9 ms
6,200 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 RE -
testcase_09 AC 2 ms
4,376 KB
testcase_10 RE -
testcase_11 AC 2 ms
4,376 KB
testcase_12 RE -
testcase_13 AC 14 ms
7,344 KB
testcase_14 AC 18 ms
9,048 KB
testcase_15 AC 25 ms
10,444 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 10 ms
6,236 KB
testcase_20 AC 16 ms
8,860 KB
testcase_21 AC 25 ms
11,164 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 27 ms
11,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main(){
    ll n, p = 0, t;
    cin >> n;
    t = pow(n, 0.5);
    vector<ll> is_prime(t, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;

    for (ll i = 2; i < t; i++){
        for(ll j = i*i; j < t; j += i) is_prime[j] = 0;
    }
    for (ll i = 2; i < t; i++){
        if ((is_prime[i]) && !(n%i)){
            p = i;
            while (n){
                if (!(n%p)) n /= p;
                else break;
            }
            break;
        }
    }
    if (n == 1 || p == 0){
        cout << "Yes" << endl;
        return 0;
    }
    for (ll i = p + 1; i <= n; i++){
        if ((is_prime[i] = 1) && !(n%i)){
            p = i;
            while (n){
                if (!(n%p)) n /= p;
                else break;
            }
            break;
        }
    }
    if (n == 1){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}
0